I had originally asked for a response to this question over at MrExcel Board, some days ago but the solution does not seem to fix the problem. I was hoping maybe someone here could shed some light on getting this macro to work.
I tried using the following
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 GetPageTitle()
Dim i As Long, url As String
For i = 1 To 4
DoEvents
url = "http://capnhud.host22.com/examples/" & Sheet1.Range("A" & i).Value & ".jpg"
URLDownloadToFile 0, url, "C:\Documents and Settings\Owner\Desktop\media\download\" & Sheet1.Range("A" & i).Value & ".jpg", 0, 0
Next
End Sub
to get these files which are listed in the A column in a new workbook with the sheet being Sheet1
117427934569752sm
117428128343967sm
117428291462196sm
117428380391871sm
and the only thing that has ever showed up was a .jpg file with no name and with no preview.
Is there something that I am missing to get this to work?
UPDATE:
Not sure what was going on but I took the above code and moved it from personal.xlsb into a separate workbook and voila it worked
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 GetPageTitle()
Dim i As Long, url As String
For i = 1 To 4
DoEvents
url = "http://capnhud.host22.com/examples/" & Sheet1.Range("A" & i).Value & ".jpg"
URLDownloadToFile 0, url, "C:\Documents and Settings\Owner\Desktop\media\download\" & Sheet1.Range("A" & i).Value & ".jpg", 0, 0
Next
End Sub
Bookmarks