Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time error 91: Object Variable or With block variable not set Ayo Excel Programming 1 August 17th 09 11:29 PM
Run-Time error '91': Object variable of With block variable not set jammin1911 Excel Programming 3 June 6th 06 06:36 PM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM
Object variable problem ExcelMonkey[_13_] Excel Programming 4 January 23rd 04 08:39 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"