Error put Dictionary into an Array

Results 1 to 2 of 2

Thread: Error put Dictionary into an Array

  1. #1
    Andrew Sinning Guest

    Default Error put Dictionary into an Array

    I&#039;m trying to create an array of dictionary objects. The array will get passed to a function which will return an HTML table. When I tyr to add a dictionary to my array, I get the following error:<BR><BR>"Wrong number of arguments or invalid property assignment"<BR><BR>Here&#039;s the code I&#039;m using:<BR><BR>dim arrColSettings(10), dictColSettings<BR><BR>&#039; quizFile<BR>set dictColSettings = CreateObject("Scripting.Dictionary")<BR>dictColSet tings.Add "header", "File Name"<BR>dictColSettings.Add "align", "left"<BR>dictColSettings.Add "entryName", "quizFile"<BR>arrColSettings(0) = dictColSettings<BR><BR>if I simply change the last line to<BR><BR>arrColSettings(0) = "hello"<BR><BR>then the error goes away. So, It looks like the problem is with putting the dictionary into the array. This should work, shouldn&#039;t it?<BR><BR>Thanks for the help!<BR>

  2. #2
    Join Date
    Dec 1969

    Default You'll kick yourself...

    ...this one is so simple.<BR><BR>You *MUST* use the Set keyword to assign object references to variables...*EVEN* when the variable in question is an element of an array!<BR><BR>SET arrColSettings(0) = dictColSettings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts