ranjithkumar10

Script to download images in VBA

Jan 16th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.54 KB | None | 0 0
  1. Option Explicit
  2. Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
  3. (ByVal pCaller As Long, _
  4. ByVal szURL As String, _
  5. ByVal szFileName As String, _
  6. ByVal dwReserved As Long, _
  7. ByVal lpfnCB As Long) As Long
  8.  
  9. Sub downloadImages()
  10. Dim rng As Range, cell As Variant
  11. Set rng = Range(Range("A2"), Range("A10000").End(xlUp))
  12. For Each cell In rng
  13. URLDownloadToFile 0, cell.Offset(0, 1).Value, Application.ActiveWorkbook.Path & "\" & cell.Value, 0, 0
  14. Next
  15. End Sub
  16.  
  17. 'credits - https://codingislove.com
Add Comment
Please, Sign In to add comment