Working with Other Applications
Accessing
Reflection FTP Methods and Properties from
Visual Basic
There are three basic steps you perform to access Reflection FTP methods and properties from Visual Basic:
1 Dimension an object variable.
2 Create a new Reflection FTP OLE Automation object and assign the object to the object variable dimensioned in step 1, using the Set statement.
Use the CreateObject function to create a new OLE Automation object; use the GetObject function to attach to an existing object.
3 Using the object variable name dimensioned in step 1, reference the Reflection FTP object in your code to access the Reflection methods and properties.
A simple example of a Visual Basic procedure that performs these steps might look something like this:
Sub ReflectionLogon()
' Dimension the object
' Using early binding syntax, which is recommended.
Dim Reflection As ReflectionFTP3
' This commented line shows late binding syntax. (Not recommended.)
'Dim RFTP As Object
' Invoke an instance of WrqFtp component
Set Reflection = CreateObject("Reflection.ftp")
' Connect to ftp.wrq.com with anonymous login
Reflection.Open "ftp.wrq.com", "anonymous"
' Store any error messages in local variable for future use
txtError = Reflection.LastErrorString
' Log out of FTP Site and disconnect
Reflection.Close
' Tell OLE we're done with the ReflectionFtp component
Set Reflection = Nothing
End Sub