?
Solved

runtime error 91 object variable or with block variable not set

Posted on 2003-03-11
5
Medium Priority
?
240 Views
Last Modified: 2010-05-01
Hi Everyone,

I am using Visual Basic + Web Control for one of my program and the part of the code where i am getting the following code is as follows

error: runtime error 91 object variable or with block variable not set

With wbCtrl.Document.body.Children
.
.
.
   With .Item(jItemNo).rows(1).cells(0).Children 'Error Line
.
.
.
.
   End With
.
.
.
End Width

in the Error Line some times i see that wbCtrl.Document.body.Children : .Item(jItemNo).rows(1).cells(0) has no children. so is there any way I check whether it has children or not so that I can avoid the following code getting run to avoid the runtime error?

Shyam Krishna
0
Comment
Question by:shyamkrishna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Sethi
ID: 8116224
This is becuase you have closed the upper With block with "End Width". Change it to "End With".
0
 

Author Comment

by:shyamkrishna
ID: 8117006
sethi thats a simple typing mistake .. how can you expect the comipler to run these lines and not when there are no children for .Item(jItemNo).rows(1).cells(0)?
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8117286
Post your code, then only will it be possible to tell the source of error. The first reaction came with what I saw in the lines you have typed.
0
 
LVL 3

Accepted Solution

by:
Marshawk earned 200 total points
ID: 8117323
What about using the all collection length on each object in question, cause if it is zero then there will be no children.

I believe both an HTMLBody and an HTMLTableCell object support the all collection property.


if wbCtrl.Document.body.all.length <> 0 Then.........
 

If yourobject.Item(jItemNo).rows(1).cells(0).all.length <> 0 Then...............
0
 

Author Comment

by:shyamkrishna
ID: 8119137
Hey Sethi.. I can understand that. Thank you.

Hey Marshawk.,

   Your answer helped me alot. thanks once again

Shyam Krishna
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question