DataBlake
Well-known Member
- Joined
- Jan 26, 2015
- Messages
- 781
- Office Version
- 2016
- Platform
- Windows
I saw this article by Vincent Tang which is a macro to download and rename images. The TL;DR being the name you want in column A & the image url/type in column B. I am currently using Excel 2016 64 bit and it seems to not be functioning properly. I was wondering if anyone could help me get this working or suggest a different method of doing this.
Here is the part of the code not working for me:
Everything else seems to work fine. It does in fact download SOME images (4/9 that i attempted), it just does not rename them to the values i put in column A. Any help would be greatly appreciated
Here is the part of the code not working for me:
Code:
Option Explicit
[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=If"]#If[/URL] VBA7 And Win64 Then
Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" ( _
ByVal pCaller As LongPtr, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As LongPtr, _
ByVal lpfnCB As LongPtr _
) As Long
Private Declare PtrSafe Function DeleteUrlCacheEntry Lib "Wininet.dll" _
Alias "DeleteUrlCacheEntryA" ( _
ByVal lpszUrlName As String _
) As Long
[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else"]#Else[/URL]
[COLOR=#ff0000] 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
Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" _
Alias "DeleteUrlCacheEntryA" ( _
ByVal lpszUrlName As String _
) As Long[/COLOR]
[URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End"]#End[/URL] If
Public Const ERROR_SUCCESS As Long = 0
Public Const BINDF_GETNEWESTVERSION As Long = &H10
Public Const INTERNET_FLAG_RELOAD As Long = &H80000000
'Global Variables for passing values b/w subs
Dim myPath As String
Dim folderPath As String
Dim folderLocation As Variant 'not used
Everything else seems to work fine. It does in fact download SOME images (4/9 that i attempted), it just does not rename them to the values i put in column A. Any help would be greatly appreciated
Last edited: