View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Colo[_37_] Colo[_37_] is offline
external usenet poster
 
Posts: 1
Default 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/