Results 1 to 14 of 14

Thread: hi guys i got an error can u help "run-time error 91 object variable or with block v"

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    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?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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.

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    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

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc

    Quote Originally Posted by techgnome View Post
    what you should be doing is using the DocumentLoad event instead - http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    -tg
    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

  9. #9

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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

  10. #10
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    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)

  11. #11

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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 ?

  12. #12
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    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:

    Quote 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)

  13. #13

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    Re: hi guys i got an error can u help "run-time error 91 object variable or with bloc

    Quote Originally Posted by Bonnie West View Post
    Here's one useful tip from Tips for Debugging:
    great advice i didn't even think about a log file.
    makes sense

  14. #14

    Thread Starter
    Lively Member
    Join Date
    May 2013
    Posts
    122

    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
  •  



Click Here to Expand Forum to Full Width