Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
using vba to download file via ftp
Need help on how to use excel vba to download file via ftp(or othe
means) from another system(specifically, openVMS alpha system). Would this also be possible to input command to this system? usin excel as the medium. Need to have an interface that could be user friendly and would no worry about the syntax being used on the openVMA system. thank you very muc -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
using vba to download file via ftp
Hello daryl,
It can be done with API and other methods... API: Please have a look at the link below. http://xcelfiles.homestead.com/Excel02.html#anchor_35 And it can be done with using command prompt as a bat file. (make a bat file for ftp then kick it from Excel.- it works on Windows2000 and the later version) Would this also be possible to input command to this system? using excel as the medium. I don't have any knowledge about openVMS alpha system so I'm not sure if it can be done. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
using vba to download file via ftp
Daryl,
this works and is very simple if your source machine can run a web server and the file you want resides somewhere within the web root. By suggesting use of FTP I am guessing you can also use http. You'll need to know the ip address of the source machine and change the strFullURL line. 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) Dim lReturn As Long Dim strFullURL As String Dim strLocation as string strFullURL = "http:\\nnn.nnn.nnn.nnn\subfolder\" & strFileName strLocation = environ("Temp") & "\" & strFileName lReturn = URLDownloadToFile(0, strFullURL, strLocation, 0, 0) If lReturn < 0 Then call msgbox("failed") End Sub Robin Hammond www.enhanceddatasystems.com "daryl " wrote in message ... Need help on how to use excel vba to download file via ftp(or other means) from another system(specifically, openVMS alpha system). Would this also be possible to input command to this system? using excel as the medium. Need to have an interface that could be user friendly and would not worry about the syntax being used on the openVMA system. thank you very much --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
using vba to download file via ftp
Actually you don't need an api call.
You can eith shell a command to run a batch file or, amd more easily, drom an inet control onto a userform. The following code can be used to send a file...it first calls a procedure to open a channel, then sends the file Private Sub SendFile() '...prepare OpenChannelToFTP ' see below With INetControl ' name of the inet control on form '...execute mbSent = False .Execute , "PUT " & msSourceFile & " " _ & TargetFile mbSent = True '...wait Do DoEvents Loop While .StillExecuting '...close .Execute , "Close" End With End Sub The following procedure is called to open an FTP channel and sets a target folder.... Private Sub OpenChannelToFTP() With INetControl .Protocol = ProtocolConstants.icFTP .URL = URL .UserName = Login .Password = Password .Execute , "CD " & TargetPath '...wait Do DoEvents Loop While .StillExecuting End With End Sub I use named variables that are pretty much self- describing. Note: the variable 'mSent' is boolean and set in the forms General area - is its scope is the code module. This is set by by the sending procedure - I use it later to test if a send worked. I also have the "statechanged" event of the inet control coded to test the ftp responses. So, you can see that this is an extremely easy-to-use interface. Patrick Molloy Microsoft Excel MVP -----Original Message----- Need help on how to use excel vba to download file via ftp(or other means) from another system(specifically, openVMS alpha system). Would this also be possible to input command to this system? using excel as the medium. Need to have an interface that could be user friendly and would not worry about the syntax being used on the openVMA system. thank you very much --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
download file of 200 name, addr.etc to excel file - how? please ad | Excel Worksheet Functions | |||
File Download Question | Excel Discussion (Misc queries) | |||
HELP----Can't get a CSV file to download onto my PC | New Users to Excel | |||
download a .csv file to Excel | Excel Discussion (Misc queries) | |||
I need to download an exel spreadsheet file. (file extension :xls) | Excel Discussion (Misc queries) |