Please bear with me it's been a while since I have done anything with Excel VBA. I'm trying to develop an application that will login to a web page and download a CSV file. I have searched for two days and tried several different code samples found on this site but I can't get it to work.
As it stands right now the code will open the URL but it does not continue to enter the username and password. It breaks on this code fragment: "If IE.ReadyState = 4 Then" with this error message:
Run-time error '-2147023170 (800706be)':
Automation error
The remote procedure call failed.
However, occasionally it will throw this error message:
Run-time error '462':
The remote server machine does not exist or is unavailable
Here is the code that I am trying-
Can anyone please give me some help? Also is there any resource where I can learn about using Internet Explorer with Excel VBA? Like I said I have searched but not found anything very comprehensive.
Thanks,
-Michael
As it stands right now the code will open the URL but it does not continue to enter the username and password. It breaks on this code fragment: "If IE.ReadyState = 4 Then" with this error message:
Run-time error '-2147023170 (800706be)':
Automation error
The remote procedure call failed.
However, occasionally it will throw this error message:
Run-time error '462':
The remote server machine does not exist or is unavailable
Here is the code that I am trying-
Code:
Sub EtsyLogin()
'Open site and login
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
'Go to the URL
IE.Navigate "https://www.etsy.com/login.php?from_page=sold_orders.php"
'Check for good connection
Do
If IE.ReadyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
'Wait for window to open!
Application.Wait (Now + TimeValue("0:00:01"))
'MsgBox "Done"
IE.Visible = True
'Send login information
SendKeys "username", True
SendKeys "{TAB}", True
SendKeys "password", True
SendKeys "{ENTER}", True
End Sub
Can anyone please give me some help? Also is there any resource where I can learn about using Internet Explorer with Excel VBA? Like I said I have searched but not found anything very comprehensive.
Thanks,
-Michael