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
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