ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import .BMP File From Web Using VBA (https://www.excelbanter.com/excel-programming/285721-import-bmp-file-web-using-vba.html)

Donnie Stone

Import .BMP File From Web Using VBA
 
Does anyone have a quick solution for saving a .bmp file from a WEB page
into excel using VBA?

Thanks,
Donnie



Colo[_37_]

Import .BMP File From Web Using VBA
 
Hi Donnie,

Here is a quick solution with API.


Code:
--------------------

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()
'Change url to the bmp
Const strUrl As String = "http://www.exceltip.com/images/newsite/hdr_bg.jpg"
Dim strSavePath As String
Dim returnValue As Long
strSavePath = ThisWorkbook.Path & "\" & "Test.jpg" 'Change Ext as .bmp
returnValue = URLDownloadToFile(0, strUrl, strSavePath, 0, 0)
MsgBox IIf(returnValue = 0, "Succeed!", "Not succeed!")
End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com