DownloadFilefromURL

  • Thread starter Thread starter a
  • Start date Start date
A

a

thank you
for your help
Ido that for many times but not work
Private Sub command_1_click()
Dim mypath As String
mypath = Application.CurrentProject.Path & "\1.jpg"
DownloadFilefromURL "any web site here ", mypath
End Sub

I don't know the reason?
 
thank you
for your help
Ido that for many times but not work
Private Sub command_1_click()
Dim mypath As String
mypath = Application.CurrentProject.Path & "\1.jpg"
DownloadFilefromURL "any web site here ", mypath
End Sub

I don't know the reason?
 
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
Public Function DownloadFilefromURL(pUrlToDownload As String,
pSaveToFilepath As String)
Call URLDownloadToFile(0, pUrlToDownload, pSaveToFilepath, 0, 0)
End Function
command_1_click
DownloadFilefromURL "any web site here ", "F:\1.jpg"
end sub

why the above code work

and this code not work? Next

command_1_click
dim mypath as string
mypath = Chr$(34) & Application.CurrentProject.Path & "\1.jpg" & Chr$(34)
DownloadFilefromURL "any web site here ", mypath
end sub

why when give expression to DownloadFilefromURL NOT WORK WHY?
 
Just because you have quotes when you define the hard-coded path doesn't
always mean you need to add them.

What happens if you try:

Private Sub command_1_click()
Dim mypath As String

mypath = Application.CurrentProject.Path & "\1.jpg"
DownloadFilefromURL "any web site here ", mypath

End Sub
 
What are you actually providing for "any web site here"?

It needs to include the http:// at the beginning.
 
Back
Top