+ Reply to Thread
Results 1 to 3 of 3

Error 91 with IE object in Excel

Hybrid View

Guest Error 91 with IE object in... 12-21-2005, 04:25 PM
Guest Re: Error 91 with IE object... 12-21-2005, 06:00 PM
Guest Re: Error 91 with IE object... 12-21-2005, 07:10 PM
  1. #1
    mfq
    Guest

    Error 91 with IE object in Excel

    I'm getting Error 91 inconsistently when I run my macro. Macro stops
    when it reaches the "USERNAME" line. I've tried setting the object to
    nothing at the end and also using a fully qualified name. None works.
    Anybody have any ideas? Does this have something to do with the browser
    object? (I'm using Excel 2000)

    Here's my code:
    ''''''''''''''''''''''''''''''''''''''''''''''''''START''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Public Sub FHLBSF()
    Dim dFRC(1 To 13, 1 To 3) As Double
    Dim ie As Object, ipf As Object, tmpWksht As Object
    Dim dDuration As Double, PctDone As Double

    ' Prepare to open the web page
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Visible = False

    With ie
    .navigate "https://member.fhlbsf.com/member/admin/login.asp?"
    Do Until Not .Busy
    DoEvents
    Loop
    End With

    ' INCONSISTENT ERROR 91 HERE
    ie.document.all.Item("UserName").Value = sUName
    ' ERROR
    ie.document.all.Item("Password").Value = sPW
    ie.document.all.Item("submitButton").Click

    ie.navigate sStandardVRCURL
    Do Until Not ie.Busy
    DoEvents
    Loop

    ie.ExecWB 17, 2
    ie.ExecWB 12, 0

    'Logout
    With ie
    Set ipf = ie.document.all.Item("menu5")
    ipf.Click
    End With

    ie.Quit
    Set ipf = Nothing
    Set ie = Nothing
    End Sub
    ''''''''''''''''''''''''''''''''''''''''''''''''''END''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


  2. #2
    jaf
    Guest

    Re: Error 91 with IE object in Excel

    If I get a visit from the FBI for testing your code....

    http://msdn.microsoft.com/library/de...gobjnotset.asp
    The error you are getting (Object variable or With block variable not set)
    means either sUName or does not have a "value"

    You need to do some error checking before those lines run.

    I don't know if your syntax is correct or not. ".value=" may not be correct
    if the data is not numeric.


    --
    John
    johnf202 at hot mail dot com


    "mfq" <mfq1975@gmail.com> wrote in message
    news:1135196457.756190.37490@g44g2000cwa.googlegroups.com...
    > I'm getting Error 91 inconsistently when I run my macro. Macro stops
    > when it reaches the "USERNAME" line. I've tried setting the object to
    > nothing at the end and also using a fully qualified name. None works.
    > Anybody have any ideas? Does this have something to do with the browser
    > object? (I'm using Excel 2000)
    >
    > Here's my code:
    > ''''''''''''''''''''''''''''''''''''''''''''''''''START''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    > Public Sub FHLBSF()
    > Dim dFRC(1 To 13, 1 To 3) As Double
    > Dim ie As Object, ipf As Object, tmpWksht As Object
    > Dim dDuration As Double, PctDone As Double
    >
    > ' Prepare to open the web page
    > Set ie = CreateObject("InternetExplorer.Application")
    > ie.Visible = False
    >
    > With ie
    > .navigate "https://member.fhlbsf.com/member/admin/login.asp?"
    > Do Until Not .Busy
    > DoEvents
    > Loop
    > End With
    >
    > ' INCONSISTENT ERROR 91 HERE
    > ie.document.all.Item("UserName").Value = sUName
    > ' ERROR
    > ie.document.all.Item("Password").Value = sPW
    > ie.document.all.Item("submitButton").Click
    >
    > ie.navigate sStandardVRCURL
    > Do Until Not ie.Busy
    > DoEvents
    > Loop
    >
    > ie.ExecWB 17, 2
    > ie.ExecWB 12, 0
    >
    > 'Logout
    > With ie
    > Set ipf = ie.document.all.Item("menu5")
    > ipf.Click
    > End With
    >
    > ie.Quit
    > Set ipf = Nothing
    > Set ie = Nothing
    > End Sub
    > ''''''''''''''''''''''''''''''''''''''''''''''''''END''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    >




  3. #3
    mfq1975
    Guest

    Re: Error 91 with IE object in Excel

    Hahaha - about the FBI comment although with the way things have been
    developing in the news of late, it wouldn't be totally impossible.
    Anyway, thanks for the site reference.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1