Help with Web Page CSV File Download

rayd8

New Member
Joined
Jun 2, 2004
Messages
2
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-
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
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Forgot to mention that the code I posted is only for connecting to the website and logging in with a username and password. Once I get that working then I'll worry about adding the code that downloads the CSV file.
 
Upvote 0
This isn't the exact answer to your question, but it's a good workaround. Etsy is using php to sign into the site. A URL like "https://www.etsy.com/login.php?from_page=your_etsy.php&username=YOURUSERNAME&password=YOURPASSWORD" should do the trick. You can just pass your username and password variables into the url string and shoot it through. The only part that may take some adjustment is the "from_page" variable. I believe that is the correct one to gain access to the admin side of the shop, but you may need a different one to get to the orders page. I guess the navigation to the orders section may be a good use for the sendkeys.
 
Upvote 0

Forum statistics

Threads
1,215,641
Messages
6,125,986
Members
449,276
Latest member
surendra75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top