|
-
May 20th, 2013, 03:37 PM
#1
Thread Starter
Lively Member
hi guys i got an error can u help "run-time error 91 object variable or with block v"
hi guys i got an error can u help "run-time error 91 object variable or with block variable not set"
my application imports a list from a text file and shells each line and tests the results.
i am using these functions
while loops
do while loops
goto commands ("i know its bad ")
i have text boxes
im using 3 timers
and using webbrowser
without me posting my entire code here could you give me a clue as where to start looking please 
and i only seem to get this error after a few loops of the entire process. not quite sure why it would error out as the first few times were successfull
BTW im jerry nice to meet you all
-
May 20th, 2013, 03:42 PM
#2
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
The most likely thing, given the small amount of information available, is that you are attempting to access a Document returned by the WebBrowser before it has been completed. How are you waiting for the Document to be completely loaded when using the WebBrowser?
-
May 20th, 2013, 03:54 PM
#3
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
hi thanks for quick reply
i am using a wait method of 5 seconds#then i also have a
dim mycounter as integer
do while webbrowser1.busy = true
mycounter = mycounter + 1
if mycounter > 10 then exit do
wait(1)
do events
loop
mycounter = 0 "just put this command in to test incase that errors out after a few loops"
edit
nope that didnt do the trick
-
May 20th, 2013, 04:04 PM
#4
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
you have got me thinking.
i have a loop that timesout after ten seconds .
i have just added a
webbrowser1.stop
im hoping that works
nope that didnt work but it did do 6 loops before error
Last edited by gerble1000; May 20th, 2013 at 04:09 PM.
-
May 20th, 2013, 04:29 PM
#5
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
Show us the line where the error occurs and the code around it
-
May 20th, 2013, 04:31 PM
#6
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
ok here is my entire sub. it is suppose to test the existence of a page true or false
Private Sub netcheck(mylink)
Dim sHTML As String
WebBrowser1.Navigate (mylink)
wait (5)
Dim mycounter As Integer
Do While WebBrowser1.Busy = True
mycounter = mycounter + 1
If mycounter > 10 Then
mycounter = 0
WebBrowser1.Stop
Exit Do
End If
wait (1)
DoEvents
Loop
mycounter = 0
sHTML = WebBrowser1.Document.documentElement.innerHTML
If InStr(1, sHTML, "The page cannot be found") > 0 Then
internetcheck = "false"
ElseIf InStr(1, sHTML, "server not found") > 0 Then
internetcheck = "false"
ElseIf InStr(1, sHTML, "page cannot be displayed") > 0 Then
internetcheck = "false"
ElseIf InStr(1, sHTML, "Navigation to the webpage was canceled") > 0 Then
internetcheck = "false"
ElseIf InStr(1, sHTML, "Action canceled") > 0 Then
internetcheck = "false"
Else
internetcheck = "true"
End If
End Sub
-
May 20th, 2013, 05:15 PM
#7
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
what you should be doing is using the DocumentLoad event instead - http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
-tg
-
May 21st, 2013, 03:51 AM
#8
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
 Originally Posted by techgnome
the only issue with that is it doesnt appear to have a timout function.
plus i rerun the code above and it seems to not have the error anymore 
thankyou for helping me pinpoint this issue
-
May 21st, 2013, 04:51 AM
#9
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
i am getting another error also
run-time error 6 overflow
i seem to get this after i stop my script and then start it again and 2 loops in exactly the error will happen
or if i get a msgbox telling me there were timeouts and then i press ok and after exactly 2 more loops it will give this error
any ideas what could cause this overflow error
-
May 21st, 2013, 05:03 AM
#10
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
Have you tried debugging your code? Debugging Your Code and Handling Errors teaches you how.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 21st, 2013, 05:10 AM
#11
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
i have thought about that but i am using visual basic on my server and the application i am building changes settings in the ip address dns ect.
i am running the application on a separate laptop for testing. is there a way i can build the exe and any error it could msgbox i ?
-
May 21st, 2013, 05:34 AM
#12
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
Here's one useful tip from Tips for Debugging:
 Originally Posted by MSDN
Create a log file. If you cannot isolate the code or if the problem is erratic or if the problem only happens when compiled, then the debugging facility of Visual Basic will be less effective. In these situations you can create a log file which records the activity of your program. This will allow you to progressively isolate the location of the suspect code. Call the following procedure from various points in your program. You should pass in a string of text which indicates the current location of the code executing in your program. Read more...
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 21st, 2013, 06:18 AM
#13
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
 Originally Posted by Bonnie West
great advice i didn't even think about a log file.
makes sense
-
May 22nd, 2013, 04:11 AM
#14
Thread Starter
Lively Member
Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc
i haven't had any errors yet. chears guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|