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


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


--
dec3
------------------------------------------------------------------------
dec3's Profile: 1398
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=171272

Microsoft Office Help