Hello,
I have pieced together the code below to navigate to a webpage and copy the information on it. I am reduced to using sendkeys and I really don't like it. If you could suggest code that could allow me to copy the data on the page instead of the sendkeys below I would really appreciate it.
On another note, you can see that the code tries to close iexplorer each time it is run. I would much rather keep it open and be able to refer to that application/window. I would appreciate any help there too.
You guys are a great help. This is my first attempt at iexplorer via VBA and I am finding it much more challenging than the Excel/Access that I am used to.
Thank you,
pd2004
Sub loadsheet(siteaddress)
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate siteaddress
objIE.Visible = 1
Do While (objIE.Busy)
Loop
Do Until objIE.ReadyState = 4
Application.Wait (Now + TimeValue("0:00:1"))
Loop
Do While objIE.Document Is Nothing
Application.Wait (Now + TimeValue("0:00:1"))
Loop
Do While objIE.Document.Body Is Nothing
Application.Wait (Now + TimeValue("0:00:1"))
Loop
Do While objIE.Busy ' is nothing
Application.Wait (Now + TimeValue("0:00:1"))
Loop
SendKeys "%EA", True
Application.Wait (Now + TimeValue("0:00:3"))
SendKeys "%EC", True
SendKeys "%FC", True
End Sub
I have pieced together the code below to navigate to a webpage and copy the information on it. I am reduced to using sendkeys and I really don't like it. If you could suggest code that could allow me to copy the data on the page instead of the sendkeys below I would really appreciate it.
On another note, you can see that the code tries to close iexplorer each time it is run. I would much rather keep it open and be able to refer to that application/window. I would appreciate any help there too.
You guys are a great help. This is my first attempt at iexplorer via VBA and I am finding it much more challenging than the Excel/Access that I am used to.
Thank you,
pd2004
Sub loadsheet(siteaddress)
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate siteaddress
objIE.Visible = 1
Do While (objIE.Busy)
Loop
Do Until objIE.ReadyState = 4
Application.Wait (Now + TimeValue("0:00:1"))
Loop
Do While objIE.Document Is Nothing
Application.Wait (Now + TimeValue("0:00:1"))
Loop
Do While objIE.Document.Body Is Nothing
Application.Wait (Now + TimeValue("0:00:1"))
Loop
Do While objIE.Busy ' is nothing
Application.Wait (Now + TimeValue("0:00:1"))
Loop
SendKeys "%EA", True
Application.Wait (Now + TimeValue("0:00:3"))
SendKeys "%EC", True
SendKeys "%FC", True
End Sub