Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to write a micro to download file at a URL save the file at the local PC
How to write a micro to download file at a URL save the file at the local PC
Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to write a micro to download file at a URL save the file at the local PC
Have a look at this windows api call:
URLDownloadToFile Be aware thought that MS appears to have changed how this functions with recent service packs / security updates, without any documentation or notification, so that it will not retrieve dll, exe, or other "potentially unsafe" files. Robin Hammond www.enhanceddatasystems.com "www.microsoft.com" wrote in message ... How to write a micro to download file at a URL save the file at the local PC Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to write a micro to download file at a URL save the file at the local PC
this id the code i use on a dily bases to download files from the internet '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''' ' Copyright ©1996-2003 VBnet, Randy Birch, All Rights Reserved. ' Some pages may also contain other copyrights by the author. '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''' ' Distribution: You can freely use this code in your own ' applications, but you may not reproduce ' or publish this code on any web site, ' online service, or distribute as source ' on any media without express permission. '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''' 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 Private Const BINDF_GETNEWESTVERSION As Long = &H10 Private Const INTERNET_FLAG_RELOAD As Long = &H80000000 Public Function DownLoadFileFromIntranet(sSourceUrl As String, _ sLocalFile As String) As Boolean 'Download the file. BINDF_GETNEWESTVERSION forces 'the API to download from the specified source. 'Passing 0& as dwReserved causes the locally-cached 'copy to be downloaded, if available. If the API 'returns ERROR_SUCCESS (0), DownloadFile returns True. DownLoadFileFromIntranet = URLDownloadToFile(0&, _ sSourceUrl, sLocalFile, _ BINDF_GETNEWESTVERSION, _ 0&) = ERROR_SUCCESS End Function Sub DownLoadFile() Dim DownLoadFile As String Dim sUrl As String DownLoadFile$ = "c:\test down load.txt" sUrl$ = "Replace this with full url for file to be downloaded" If DownLoadFileFromIntranet(sUrl, DownLoadFile) = False Then do something else do something else end if End Sub -- mudraker ------------------------------------------------------------------------ mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473 View this thread: http://www.excelforum.com/showthread...hreadid=520143 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
download to save excel file from IE7 | Excel Discussion (Misc queries) | |||
Hypoerlink to a Local file and emailing the file as an attachment | Excel Discussion (Misc queries) | |||
Can I write an excel formula to display the file save date? | Excel Worksheet Functions | |||
where is my personal micro file | New Users to Excel | |||
I need to download an exel spreadsheet file. (file extension :xls) | Excel Discussion (Misc queries) |