Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Download .png


Hi.

Does anybody know how to download a .png file from the internet using Excel
XP.

I want to pass the address to Excel, and then download that address (which
will be a .png file) to my local hard drive.

I have tried things in the past, without success, but because they didn't
work I deleted the code so can't easily reproduce the code.

Cheers.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Download .png


Hello

you may try these 2 examples
you will have to adapt the web address ( not existing in this examples
)


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 Const ERROR_SUCCESS As Long = 0

Sub LancementProcedure()
DownloadFile "http://theWebPage/picture.png", "C:\monImage1.gif"
End Sub

Public Function DownloadFile(ByVal sURL As String, ByVal sLocalFile As
String) As Boolean
Dim lngRetVal As Long
DownloadFile = URLDownloadToFile(0&, sURL, sLocalFile, 0&, 0&) =
ERROR_SUCCESS
End Function


*************


Sub recupererImageWeb_WinHttp()
'activate library : Microsoft WinHttp Services ,version 5.1
Dim b() As Byte
Dim h As Long
Dim oWinHttp1 As WinHttp.WinHttpRequest

h = FreeFile
Open "C:\monImage2.png" For Binary As #h

Set oWinHttp1 = New WinHttp.WinHttpRequest
oWinHttp1.Open "GET", _
"http://theWebPage/picture.png", False

oWinHttp1.Send
oWinHttp1.WaitForResponse (30)
b() = oWinHttp1.ResponseBody

Set oWinHttp1 = Nothing
Put #h, 1, b()
Close #h
End Sub




regards ,
michel


--
michelxld
------------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367
View this thread: http://www.excelforum.com/showthread...hreadid=384071

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Download .png

Thank you.

I tried the first example and it worked great, so didn't go on with the
second one.

I justmodified it so it saves it as a .png file (there is a reason for
this!!).

Cheers

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
download csv shakey[_2_] Excel Discussion (Misc queries) 0 March 17th 09 11:36 PM
items chosen to download are NEVER all there after download comple jwhitehurst New Users to Excel 3 November 9th 07 04:00 PM
Useful add-ins to download [email protected] Excel Worksheet Functions 2 March 17th 06 07:15 PM
Useful add-ins to download [email protected] Excel Discussion (Misc queries) 0 March 17th 06 04:21 AM
how can i download sarfer Excel Discussion (Misc queries) 1 January 9th 06 09:26 PM


All times are GMT +1. The time now is 03:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"