Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: VBA Reference clarification

And does the mySession As New Session works?
Guest

Re: VBA Reference clarification

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

Re: VBA Reference clarification

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

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?
Mick

VBA Reference clarification

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