sudharshan86
New Member
- Joined
- May 26, 2014
- Messages
- 13
I need to download .PDF files from url.
I tried the below code and it is not working.
can someone help.
Script referred from http://www.mrexcel.com/forum/excel-questions/740193-visual-basic-applications-download-pdf-url.html
I tried the below code and it is not working.
Code:
Option Explicit
Private 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
Sub Test()
Dim strPDFLink As String
Dim strPDFFile As String
Dim Result As Boolean
strPDFLink = "http://www.bnpparibasmf.in/Uploads/D...ds/Requirement under PMLA Act 2002 and Rules frame thereunder.pdf"
strPDFFile = "Requirement under PMLA Act 2002 and Rules frame thereunder.pdf"
Result = DownloadFile(strPDFLink, strPDFFile)
MsgBox Result
End Sub
Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
can someone help.
Script referred from http://www.mrexcel.com/forum/excel-questions/740193-visual-basic-applications-download-pdf-url.html