Page 1 of 1

Expected Function or Variable

Posted: Wed Feb 25, 2015 10:20 pm
by donj91711
I've been using the SmartFTP library for years now. I just upgraded to the newest version. Now it doesn't work.
 
I'm using VB6 and trying to use the sample that came with the new version. Here's the code exactly as downloaded:
 
START CODE
Sub Main()
    ' VB6 binding howto
    ' http://kandkconsulting.tripod.com/VB/Tu ... torial.htm
 
    'Early Binding "Dual Interface"
    'Note: Force the compiler to use the dual interface if available
    Set objGlobal = CreateObject("sfFTPLib.Global")
 
                ' TODO: Uncomment the line and insert the provided serial after the purchase of the license.
                ' A trial license is automatically obtained from the license server. In this case do NOT uncomment the line.
                'objGlobal.LoadLicense("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
 
    'Early Binding "Dual Interface"
    'Note: Force the compiler to use the dual interface if available
    Set objSSH = CreateObject("sfFTPLib.SSHConnection")
    
    'Early Binding "Mid Level"
    'Note: The compiler may use the dual interface
    'Set objSSH = New sfFTPLib.SSHConnection
    
    objSSH.Host = "yourhost"
    objSSH.Port = 22
    objSSH.Username = "anonymous"
    objSSH.Password = "test@test.com"
    objSSH.LogFile.File = "ssh.log"
    
    objSSH.Connect()
    MsgBox ("Connected.")
                SFTPTest()
                objSSH.Disconnect()
End Sub
END CODE
 
The line: 
objSSH.Connect()
shows a syntax error, so I change it to:
ret = objSSH.Connect() 
 
So the bottom section of the code is:
 
    ret = objSSH.Connect()
    MsgBox ("Connected.")
    ret = SFTPTest()
    ret = objSSH.Disconnect()
 
After that change it says: "Expected Function or Variable" and it highlights the ".Connect()"
 
I can't even run the code to test anything because of the syntax errors.
 
The Project/References has an entry for "SmartFTP FTP Library 4.0 Type Library"
 
Can anyone tell me what I'm doing wrong?
 

Re: Expected Function or Variable

Posted: Wed Feb 25, 2015 10:56 pm
by mb
Replace the call with
Call objSSH.Connect
 
The samples have been updated accordingly.

Re: Expected Function or Variable

Posted: Wed Feb 25, 2015 11:06 pm
by donj91711
Thank you, that worked.
 
Now the line: Set objGlobal = CreateObject("sfFTPLib.Global")
 
gets a run-time error: Automation Error. The specified procedure could not be found