E
Eric Noland
I recently saw this VB code in a module I was given, and it looks suspicious
to me. Can anybody tell me what is does?
Private Sub TestFTPUpload()
On Error GoTo errHandler
Dim objFTP As InetTransferLib.FTP
Const conTarget = "ftp://ftp.someserver.com"
Set objFTP = New InetTransferLib.FTP
With objFTP
.FtpURL = conTarget
.SourceFile = vbNullString
.DestinationFile = "/2/test.txt"
.AutoCreateRemoteDir = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost "username", "password"
.UploadFileToFTPServer
End With
ExitHere:
On Error Resume Next
Set objFTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
errHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub
Private Sub TestFTP()
On Error GoTo errHandler
Dim objFTP As InetTransferLib.FTP
Const conTarget = "ftp://ftp.microsoft.com/softlib/softlib.exe"
Set objFTP = New InetTransferLib.FTP
With objFTP
.UseProxy = True
.FtpURL = conTarget
.DestinationFile = "h:\temp\test.exe"
'If .FileExists Then .OverwriteTarget = True
.PromptWithCommonDialog = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost
.WriteFTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objFTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
errHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub
Private Sub TestHTTP()
On Error GoTo errHandler
Dim objHTTP As HTTP
Const conTarget = "http://google.com"
'Application.FollowHyperlink
Set objHTTP = New HTTP
With objHTTP
'.About
.HttpURL = conTarget
'.DestinationFile = "j:\temp\test.htm"
.PromptWithCommonDialog = True
If .FileExists Then .OverwriteTarget = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
errHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub
to me. Can anybody tell me what is does?
Private Sub TestFTPUpload()
On Error GoTo errHandler
Dim objFTP As InetTransferLib.FTP
Const conTarget = "ftp://ftp.someserver.com"
Set objFTP = New InetTransferLib.FTP
With objFTP
.FtpURL = conTarget
.SourceFile = vbNullString
.DestinationFile = "/2/test.txt"
.AutoCreateRemoteDir = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost "username", "password"
.UploadFileToFTPServer
End With
ExitHere:
On Error Resume Next
Set objFTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
errHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub
Private Sub TestFTP()
On Error GoTo errHandler
Dim objFTP As InetTransferLib.FTP
Const conTarget = "ftp://ftp.microsoft.com/softlib/softlib.exe"
Set objFTP = New InetTransferLib.FTP
With objFTP
.UseProxy = True
.FtpURL = conTarget
.DestinationFile = "h:\temp\test.exe"
'If .FileExists Then .OverwriteTarget = True
.PromptWithCommonDialog = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToFTPHost
.WriteFTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objFTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
errHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub
Private Sub TestHTTP()
On Error GoTo errHandler
Dim objHTTP As HTTP
Const conTarget = "http://google.com"
'Application.FollowHyperlink
Set objHTTP = New HTTP
With objHTTP
'.About
.HttpURL = conTarget
'.DestinationFile = "j:\temp\test.htm"
.PromptWithCommonDialog = True
If .FileExists Then .OverwriteTarget = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
errHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub