Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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 to save excel file from IE7 jasonr17 Excel Discussion (Misc queries) 5 March 20th 07 08:36 PM
Hypoerlink to a Local file and emailing the file as an attachment JohnH Excel Discussion (Misc queries) 0 January 2nd 07 06:45 PM
Can I write an excel formula to display the file save date? Bob-123456789 Excel Worksheet Functions 1 January 26th 06 07:50 PM
where is my personal micro file Tian New Users to Excel 2 May 18th 05 10:24 PM
I need to download an exel spreadsheet file. (file extension :xls) buckrogers Excel Discussion (Misc queries) 2 December 8th 04 11:08 PM


All times are GMT +1. The time now is 04:33 AM.

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

About Us

"It's about Microsoft Excel"