Excel VBA sessionoption object returns Activex cannot create object error

Advertisement

karthiknsra
Joined:
Posts:
6
Location:
MK

Excel VBA sessionoption object returns Activex cannot create object error

Hi,

I have recently registered the winscpnet.dll using .NET Framework C:\Windows\Microsoft.NET\Framework64\v2.0.50727. And I have added the tlb file generated to my VBA references. But when I try to instantiate sessionoptions object, it throws an error "Activex cannot create object". Not sure what went wrong here. Could you please guide.

Regards
Karthik

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,094
Location:
Prague, Czechia

Re: Excel VBA sessionoption object returns Activex cannot create object error

My answer to your duplicate post on Stack Overflow:
https://stackoverflow.com/q/35091706/850848

The Microsoft Excel is 32-bit application, so you probably have to register the WinSCPnet.dll for 32-bit .NET framework, even on 64-bit system.

As the instructions for registering the WinSCP .NET assembly for COM shows, on 64-bit system, you generally need to register the assembly both for 32-bit and 64-bit:

%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

Do not add the .tbl manually to Excel. The assembly appears itself after being registered correctly.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,094
Location:
Prague, Czechia

karthiknsra wrote:

Thank you so much. This resolved the problem.
You are welcome. Can you accept my answer on Stack Overflow to close the question?

Reply with quote

Advertisement

You can post new topics in this forum