could not create object named "WinSCP.SessioOption"

Advertisement

Guest

could not create object named "WinSCP.SessioOption"

Hi,


I have 2 devices running windows 10 and a server running 2012R2 and when I run a wsf script to upload files via ftp one windows 10 device works OK but the other w10 device and the 2012 server both give an error

could not create object named "WinSCP.SessioOption"

I have registered the com on all devices using the following commands without error


%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

code excerpt failing - Set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")


any ideas ?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: could not create object named "WinSCP.SessioOption"

Didn't you have a different version of WinSCP .NET assembly registered already on those machines?

Reply with quote

duetto
Joined:
Posts:
1

i have the same problem and yes i have an earlier version of winscp registered. how do you delete/unregister it? i have tried regsvr32 /u "path to registered winscp"

john

Reply with quote

martin
Site Admin
martin avatar

duetto wrote:

i have the same problem and yes i have an earlier version of winscp registered. how do you delete/unregister it? i have tried regsvr32 /u "path to registered winscp"
Use regasm.exe /unregister ...

Reply with quote

Guest

runtime automation error iin vba

I encountered the same problem. I have an older version of the dll installed and registered. I updated the installed version to the latest version. problem is I was not able to unregister the old dll version.

I encountered the runtime automotation error. After searching for solutions here is what I have done so far:

1. Unregistered the latest winscpnet.dll
2. Uninstalled the latest version
3. Re-installed previous version
4. Registered prev version of winscpnet.dll
5. Unregistered the prev version of winscpnet.dll
6. Checked with the registry if there are still winscp32.dll references (none were found!!!)
7. Re-installed latest version
8. Registered latest winscpnet.dll

Now I have the winscpnet32.tlb in same directory as WinSCP.exe executable

I open my excel file, re-reference the library in VBA editor, run my macro and still the automation error occurred.

here my code snippet

Dim ftp_session As New Session
Dim ftp_sessionoptx As New SessionOptions

With ftp_sessionoptx ' <--this is where debugger points to for the error
        .Protocol = Protocol_Ftp
        .Hostname = GlobalVariable(FTP_SERVER)
        .UserName = "anonymous"
        .Password = ""
End With

Hope someone can help me on this.

Thank you.

Alfred.Ayson, PMP

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: runtime automation error iin vba

Anonymous wrote:

I encountered the same problem. I have an older version of the dll installed and registered. I updated the installed version to the latest version. problem is I was not able to unregister the old dll version.

I encountered the runtime automotation error. After searching for solutions here is what I have done so far:
...
As documented:
https://winscp.net/eng/docs/library_install#side-by-side

Reply with quote

alfred.ayson
Joined:
Posts:
1

Good Day,

Thank you for your reply. I followed the steps and looked for the possible version which I needed to "Unregister". I went through every version on sourceforge to get each installer.

Steps performed:
1. Install
2. Copy dll to install folder
3. Unregister dll
4. Uinstall

I went through several versions doing this. When I have completed doing this upto the latest version. I re-installed the latest version and registered the dll.

Upon running the macro no automation error occurred but it now says that "Method or Data not found" and upon debugging it goes to Session.Open.

[code]
Sub GetFilesFromFTP()
Dim ftp_session As New Session
Dim ftp_sessionoptx As New SessionOptions

With ftp_sessionoptx
.Protocol = Protocol_Ftp
.Hostname = GlobalVariable(FTP_SERVER)
.UserName = "anonymous"
.Password = ""
End With

ftp_session.Open ftp_sessionoptx '<--error points here
End Sub
[/code]

Now I'm stumped. Would need help here.

Regards,
Alfred Ayson, PMP

Reply with quote E-mail

Advertisement

You can post new topics in this forum