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??
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..
It's always working !
Hi punna111,
When that's not working I usually try something like:
And sometimes throw a 'DoEvents in the loops for good measure.![]()
'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
Lewis
@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:
What to do..![]()
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
I am using APP Activate to activate the window.
Sorry.
At the top of the module you need (Option Explicit) should only appear once.
Lewis![]()
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
still same error
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):
Lewis![]()
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks