Excel Looper To Access Various Weblinks, Download pdf files and save to a folder..help please

dwilson38550m

Board Regular
Joined
Nov 21, 2005
Messages
89
Hi,

I am trying to create a programme that will (I) access a website/intranet (noted in cell A1 Sheet1), then download a .pdf file from that website/intranet, (ii) save this pdf to a dedicated folder (C:\Users\Desktop\Files ) with a specific file name then (iii) loop down to the next website (noted in cell A2 Sheet1) and save this pdf to a dedicated folder (C:\Users\Desktop\Files ) with a (different) specific file name then (iv) repeat for another link cell A3, A4, A5 etc etc. The idea is that I can access a (company) website, download a batch of invoices (numbers noted on cell B1, B2, B3, B4 etc), then distribute these to customers. To do this manually one by one would take forever.

The website will be listed on cells A1, A2, A3, A4 etc and will be fixed but the only thing that will change will be the invoice number in the middle....so in the macro I need this to point to cell A1 perform an action then loop to cell A2, perform an action then loop to cell A3 etc.

I have attached a VBA macro I have used to access an internet site by activating a macro command in Excel.
The website downloads the invoices to DOWNLOADS on my PC but I really want to download these to C:\Users\Desktop\Files and have the ability to fix the filename that is used to save the file). Any help would be greatly appreciated.

Thanks in advance.
----------------------------------------------------

' webaccess Macro
'
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://www.WEBSITEADDRES&INVOICENUMER&XXXXXX"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document


Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If


'
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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