VBA to copy pdf's from a hyperlink (1 Viewer)

DavidCon

Registered User.
Local time
Today, 11:30
Joined
Apr 14, 2011
Messages
23
Hi,
I’ve searched and searched for a solution to this but have been unable to find one and I am not competent enough in VBA to write the code myself .
I have a query which lists the hyperlink of a pdf we have help on our server. What I want to do is to run some VBA to take this list and save the pdfs to a chosen location.
If anyone is able to shed any light on this I would very much appreciate it.
I only have three fields in the query – [SupplierName], [InvoiceNumber] & [Path]
[Path] will be the field used to copy the PDF.
If anyone can please suggest how I would do this it would be a great help and help my understanding also!
 

sneuberg

AWF VIP
Local time
Today, 11:30
Joined
Oct 17, 2014
Messages
3,506
I helped a forum member with a similar problem in this thread. The main thing you would need from this is the API to download a URL. If you put the code that follows in a module you will at least have that function.


Code:
Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
    (ByVal pCaller As Long, ByVal szURL As String, _
    ByVal szFileName As String, ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) As Long
Function DownloadURL(sSourceUrl As String, sLocalFile As String) As Boolean
    DownloadURL = (URLDownloadToFile(0&, sSourceUrl, sLocalFile, 0&, 0&) = 0)
End Function

If you can upload your database or a copy with the relevant parts I'll see if I can come up with some code for you. No promises on how fast though.
 

Users who are viewing this thread

Top Bottom