LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Downloading a file via FTP in code

Fantastic - thank you :)

Jeff

"Robin Hammond" wrote in message
...
Jeff,

there's an API call I use a lot. It should work with an FTP site.

'API file download call
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal strURL As String, _
ByVal strFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long

Public Sub GetInternetFile(strFileName As String, strTargetFolder As

String)
Dim lReturn As Long
Dim strFullURL As String
Dim strLocation As String

strFullURL = "http://100.100.100.100/" & strFileName
strLocation = strTargetFolder & strFileName

On Error Resume Next
SetAttr strLocation, vbNormal
On Error GoTo 0

lReturn = URLDownloadToFile(0, strFullURL, strLocation, 0, 0)
If lReturn < 0 Then msgbox "download failed"
End Sub

Robin Hammond
www.enhanceddatasystems.com

"Jeff Standen" wrote in message
...
Hi all,

I'd like to download a file to a specified directory in code, without
resorting to what I currently do, which is writing a text file, saving

it
and using Shell() to call the Windows FTP program. Is there a simpler

way
to
do this?

Cheers,

Jeff
Using Win XPPro & Office 2003






 
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
trouble downloading 2003 excel file Keith Excel Discussion (Misc queries) 1 January 17th 09 01:13 PM
Downloading Excel file from SQL application janee Excel Discussion (Misc queries) 6 October 3rd 08 06:10 PM
How do I open a file downloading in MS Excel shorty Excel Worksheet Functions 1 April 2nd 05 03:45 PM
Deleting code in a file with code.. KimberlyC Excel Programming 3 March 4th 04 09:24 PM


All times are GMT +1. The time now is 02:15 AM.

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"