SFTP - VBA/Access - Error automation when creating a Session
Configuration :
Windows XP
Access 2003 SP3
WinSCP 5.5.0 (winscp550.zip et winscp550automation.zip) with WinSCP.com, WinSCP.exe and WinSCPnet.dll in the same folder.
We use an Access/VBA program to upload and download files from a SFTP server.
Our code is below :
Registration :
Set WshShell = CreateObject("wscript.shell")
strCommande = """C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" "WinSCPnet.dll" /codebase /tlb"""
WshShell.Run strCommande, 0, True
UN-registration :
Set WshShell = CreateObject("wscript.shell")
strCommande = """C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" "WinSCPnet.dll" /unregister /tlb"""
WshShell.Run strCommande, 0, True
Session options :
Dim mySession As New WinSCPnet.Session
Dim mySessionOptions As New WinSCPnet.sessionOptions
With mySessionOptions
.Protocol = WinSCPnet.Protocol_Sftp
.HostName = strHostName
.PortNumber = lngPortNumber
.SshHostKeyFingerprint = strSshHostKeyFingerprint
.UserName = strUserName
.SshPrivateKeyPath = strSshPrivateKeyPath
End With
mySession.Open mySessionOptions
Registration and un-registration seemed always to work fine, and the Access/VBA program was always able to add a reference to the TLB file.
But for approximately 10 of the 100 machines, we got an "error automation" error (-2146232576 or -2146233321) when creating an instance of the Session class.
On these 10 machines, we have uninstalled and unregistered all the versions of WinSCP.dll and WinSCPnet.dll and reinstalled and re-registered the WinSCP .NET Assembly (5.5.0), but we get always the same "error automation" errors.
What can we do ?