+ Reply to Thread
Results 1 to 7 of 7

IE.busy is not working

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Question IE.busy is not working

    I am using IE.busy code for internet explorer automation.
    but it is not working.
    I also tried IE.readystate, it is also not working.
    any suggestions??
    Regards,
    PRB.

    Right time to become Expert..

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: IE.busy is not working


    It's always working !

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: IE.busy is not working

    Hi punna111,

    When that's not working I usually try something like:
            'Navigate to the URL
            ie.Navigate sUrl
      
            'Wait until Internet Explorer is not busy and ready
            Do While ie.Busy Or ie.readyState <> 4
              Sleep 200
            Loop
      
            'After not busy and ready, wait until status is 'Done'
            If ie.StatusText <> "Done" Then
              Sleep 200
            End If
    And sometimes throw a 'DoEvents in the loops for good measure.

    Lewis

  4. #4
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Re: IE.busy is not working

    @MARC L -- Its not working for me
    LJMETZGER -- your code giving error at Sleep 200 as sub or function not defined.

    BELOW IS MY ACTUAL CODE:

    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    
    
    Dim i As String
    Dim l As Long
    Dim J As String
    Dim d As Integer
    Dim s As String
    lrow = Sheets(8).Cells(Rows.Count, 1).End(xlUp).Row
    AppActivate "WORKFLOW WINDOW"
    
    For d = 2 To lrow
    i = Range("a" & d).Text
    Call SendKeys(i)
    Call SendKeys("{tab}")
    l = Range("b" & d).Value
    
    Call SendKeys(l)
    Call SendKeys("{F12}")
    Application.Wait Now + TimeValue("0:00:07")
    
    'Do Until IE.ReadyState = 1  'While IE.ReadyState <> READYSTATE_COMPLETE
     ' DoEvents  'wait until IE is done loading page.
    'Wend
    'Loop
    
    While IE.Busy
      DoEvents  'wait until IE is done loading page.
    Wend
    What to do..
    I am using APP Activate to activate the window.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: IE.busy is not working

    Sorry.

    At the top of the module you need (Option Explicit) should only appear once.
    Option Explicit
    
    #If VBA7 And Win64 Then
        ' 64 bit Excel
        'NOTE: The following line is supposed to be RED in 32 bit Excel
        Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongLong)
    #Else
        ' 32 bit Excel
        Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    #End If
    Lewis

  6. #6
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Re: IE.busy is not working

    still same error

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: IE.busy is not working

    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. dim i as Integer). See http://www.cpearson.com/excel/DeclaringVariables.aspx

    Try this (tested and working in Excel 2003 on Vista 32 bit system):
    Option Explicit
    
    #If VBA7 And Win64 Then
        ' 64 bit Excel
        'NOTE: The following line is supposed to be RED in 32 bit Excel
        Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongLong)
    #Else
        ' 32 bit Excel
        Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    #End If
    
    #If VBA7 And Win64 Then
      ' 64 bit Excel
      'NOTE: The following line is supposed to be RED in 32 bit Excel
      Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As LongPtr, ByVal nCmdShow As Long) As Long
    #Else
      ' 32 bit Excel
      Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    #End If
    
    Private Const SW_MAXIMIZE = 3
    Private Const SW_SHOWNORMAL = 1
    Private Const SW_SHOWMINIMIZED = 2
    
    Sub InternetExplorerAutomation()
    
    
      Dim IE As Object
      Dim sUrl As String
      
      
      Set IE = CreateObject("InternetExplorer.Application")
    
      IE.Visible = True
      ShowWindow IE.hwnd, SW_SHOWMINIMIZED
    
    
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      'Access the Web Site
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      sUrl = "http://www.excelforum.com/excel-programming-vba-macros/1028765-ie-busy-is-not-working.html"
      
      With IE
        .AddressBar = False
        .Navigate sUrl                      'URL
      End With
      
      
      'Wait until Internet Explorer is not busy and ready
      Do While IE.Busy Or IE.readyState <> 4
         Sleep 200
         DoEvents
      Loop
      
      'After not busy and ready, wait until status is 'Done'
      If IE.StatusText <> "Done" Then
        Sleep 200
        DoEvents
      End If
      
      'Other code follows
      '...
      
      'Stop here - because we want to examine the IE Window
      Exit Sub
      
      
      
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      'Termination
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      IE.Quit
      Set IE = Nothing
      
    
    End Sub
    Lewis

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hello, Im Melis K. and busy with my own (hobby) Project
    By Melis K. in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 04-03-2013, 05:37 AM
  2. Server too Busy
    By Mordred in forum Suggestions for Improvement
    Replies: 4
    Last Post: 08-01-2012, 12:47 PM
  3. [SOLVED] Server TOO busy error
    By protonLeah in forum Suggestions for Improvement
    Replies: 20
    Last Post: 03-20-2012, 04:44 AM
  4. Adjust the plan date if busy
    By bebo021999 in forum Excel General
    Replies: 8
    Last Post: 03-13-2012, 10:16 PM
  5. Keeping my computer busy
    By Vnagpal in forum Excel General
    Replies: 3
    Last Post: 12-09-2005, 07:55 PM

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