PDA

View Full Version : Variables containing spaces



quint
10-07-2010, 07:08 AM
Hi, I am trying to access an element of a variable that has a space in its name. See attached a screenshot of the tree structure.

The way I'm trying is:
msgbox XML.responseXML.LastChild.ChildNodes.[Item 1].baseName but I get an error "Object does not support this property or method". Am I using the right syntax to refer to Item 1? I can access elements on the same level as Item 1 and above. Intellisense doesn't show anything when pressing period after an element name. Many thanks.

Paul_Hossler
10-07-2010, 01:23 PM
My guess would be something like




msgbox XML.responseXML.LastChild.ChildNodes(1).baseName


Paul

quint
10-07-2010, 05:44 PM
Thanks Paul, I got an error 91: "Object variable or With block variable not set", but changing to:

msgbox XML.responseXML.LastChild.ChildNodes(0).baseName

worked a treat, presumably because the indexing starts at zero rather than one.

Thanks again for your help.

Bob Phillips
10-08-2010, 03:44 AM
quint,

Have you got a file we can work with?