[英]WinSCP .NET assembly with VBA throwing ActiveX component can't create object
I have recently registered the WinSCPnet.dll
using .NET Framework C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727
.我最近使用 .NET Framework
C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727
注册了WinSCPnet.dll
。 And I have added the tlb file generated to my VBA references.我已将生成的 tlb 文件添加到我的 VBA 引用中。 But when I try to instantiate
SessionOptions
object, it throws an error "ActiveX component can't create object" .但是当我尝试实例化
SessionOptions
对象时,它会引发错误“ActiveX 组件无法创建对象” 。 Not sure what went wrong here.不知道这里出了什么问题。
Also, I found that I was able to connect using VBScript.此外,我发现我可以使用 VBScript 进行连接。 But if I use VBA, it is not working.
但是如果我使用 VBA,它就不起作用。 Can anyone suggest what is the problem?
任何人都可以建议是什么问题?
If your Microsoft Excel installation is 32-bit application, you have to register the WinSCPnet.dll
for 32-bit .NET framework, even on a 64-bit system.如果您的 Microsoft Excel 安装是 32 位应用程序,则您必须为 32 位 .NET 框架注册
WinSCPnet.dll
,即使在 64 位系统上也是如此。
As the instructions for registering the WinSCP .NET assembly for COM show, on 64-bit system, you generally need to register the assembly both for 32-bit and 64-bit:正如为 COM 注册 WinSCP .NET 程序集的说明所示,在 64 位系统上,您通常需要为 32 位和 64 位注册程序集:
%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.不要将
.tbl
手动添加到 Excel。 The assembly appears itself after being registered correctly.程序集在正确注册后出现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.