I just moved from WinSCP 5.9.3 on a Windows Server 2008 R2 which ran the .Net Assembly and COM library beautifully from Access 2010 32-bit (VBA).
Now on a Windows 2016 server with Access 2010 32-bit (VBA), I have tried WinSCP 5.9.3 and 5.11.2 and cannot get past opening the SessionOptions. WinSCP GUI works perfectly when I run it manually (I can connect to multiple FTP sites and transfer files). But using the .Net Assembly/COM files from VBA causes the error below. This appears to me to be an issue with registering the .dll file or adding the Reference to it but I cannot get it to work.
Here is the VBA code:
Dim SessionOptions As New SessionOptions
With SessionOptions <<------------------- Error happens here
.Protocol = Protocol_Sftp
.hostName = vFTPServ
.username = vUser
.password = vPass
.SshHostKeyFingerprint = "ssh-rsa 1024 3a:a8:c2:c0:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:60:be"
Here is the error:
Run-time error '-2146232576 (80131700)':
SessionOptions = <Object variable or With block variable not set>
Things I have already tried:
- Registered and Unregistered the .dll files successfully many times using the online examples:
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb:WinSCPnet32.tlb
%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb:WinSCPnet64.tlb
- Re-selected the Reference to the WinSCP Scripting Interface .Net Wrapper
- Made sure the .dll, .tlb, and WinSCP.exe files are all in the same folder.
- Rebooted the server
- I checked the log file but nothing gets logged this early in the process. (Manually running WinSCP does log connections just fine.)
Help! WinSCP is wonderful when it is working!