View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1298_] Simon Lloyd[_1298_] is offline
external usenet poster
 
Posts: 1
Default object variable or with variable not set problem


Can you give us the full code?, have you declared oDom?dec3;616491 Wrote:
Hi,
I’m not a programmer but I have cobbled together some VBA to call a web
service. I have a problem with nil returns that I’d be very very
grateful for some help with…

When I get a valid XML response the following code works fine…..

-If oDom.HasChildNodes Then-
-Worksheets("Sheet1").Range("c4").Value-
-oDom.DocumentElement.SelectSingleNode("record/offer/for").Text-

But when there is not a valid response I get an XML response is like
this:

-<nil-classes type="array"/-
-− <!---
-{:fetched_at=Tue Jan 19 00:09:50 -0800 2010, :expires_in=1800
seconds} -
----

I then get the VBA error “*-object variable or with variable not set-*"
I from the following line of code
-oDom.DocumentElement.SelectSingleNode("record/offer/for").Text-


In both situations haschildnodes is true, so how do I determine if I’ve
had a valid response or not without getting the VBA error?

Many many thanks
DEC



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=171272

Microsoft Office Help