Topic "VBA Reference clarification"

Author Message
Mick
[View user's profile]

Joined: 2017-01-09
Posts: 1
Location: Sydney
Hi,

I am a new user of WINSCP with automation. I have installed and "successfully" registered the dll following the commands on the website https://winscp.net/eng/docs/library_install#registering. However when I attempt to add the reference to "WinSCP console interface .NET wrapper " the only interface I see is "WinSCP scripting interface .NET wrapper".

Is this the correct interface to use ?
If not then does that imply that it has not registered correctly ?

I have tried writing a very simple routine to instantiate the Session as per below:

Public Sub myUpload()

Dim mySession As New Session

On Error Resume Next

If Err.Number <> 0 Then
MsgBox "Error: " & Err.Description

' Clear the error
Err.Clear
End If

' Setup session options
Dim mySessionOptions As New SessionOptions
With mySessionOptions
'.Protocol = Protocol_Sftp
'.HostName = "example.com"
'.UserName = "user"
'.Password = "mypassword"
'.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
End With


End Sub

This causes an Automation Error, HelpConext 1000440, and Error.Number -2146232576.
I have tried googling these but have not found any solution yet so I ammgoing to uninstall WinSCP and start again.

Please advise.

Many Thanks

Mick
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
Quote:
I am a new user of WINSCP with automation. I have installed and "successfully" registered the dll following the commands on the website https://winscp.net/eng/docs/library_install#registering. However when I attempt to add the reference to "WinSCP console interface .NET wrapper " the only interface I see is "WinSCP scripting interface .NET wrapper".

Is this the correct interface to use ?

That's correct.
I've updated the documentation for the new description:
https://winscp.net/eng/docs/library_vb

Quote:
This causes an Automation Error, HelpConext 1000440, and Error.Number -2146232576.
I have tried googling these but have not found any solution yet so I ammgoing to uninstall WinSCP and start again.

What line causes this?
Do you really have the "xx:xx.." in the code or did you update it to the actual host key fingerprint?
Guest




Quote:
Quote:
This causes an Automation Error, HelpConext 1000440, and Error.Number -2146232576.
I have tried googling these but have not found any solution yet so I ammgoing to uninstall WinSCP and start again.

What line causes this?
Do you really have the "xx:xx.." in the code or did you update it to the actual host key fingerprint?


No if you look closely all of the Statements within the "With" block have been commented out.
The code fails on the "With mySessionOptions" line, if you look at this variable in the "Watch" window thn you get the following message as the value "mySession : <Object variable or With block variable not set>".

It seems not to have nstantiated an instance of this object successfully.

As a workaround I am looking at using the scripting functionality to be fired off from Excel but not an ideal solution (and not really my strength)

Thanks fro your prompt response.

Mick
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
And does the mySession As New Session works?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License