简体   繁体   English

ActiveX组件无法创建Sage数据对象

[英]ActiveX component cannot create Sage Data Object

I'm using some slightly amended VBA code provided by Sage to connect to Sage 50 Accounts - this works on some machines, but not with others, despite them all having the same version of Sage (25.1.128), and has previously worked on all machines without issue. 我正在使用由Sage提供的一些经过稍微修改的VBA代码来连接到Sage 50帐户-尽管某些机器都具有相同版本的Sage(25.1.128),并且在以前的机器上工作,但该机器在某些机器上有效,但在其他机器上则无法使用所有机器都没有问题。 The error specifically occurs when attempting to instantiate the Sage Data Object, where i get 'Run-time error ' 429': ActiveX component can't create object' . 当尝试实例化Sage数据对象时,特别是发生错误,在此我得到“运行时错误429”:ActiveX组件无法创建对象”

I've tried reinstalling Sage on one of the problem machines and checked the correct references are added to the VBA project. 我尝试在其中一台有问题的计算机上重新安装Sage,并检查是否已将正确的引用添加到VBA项目中。 All machines in question are running windows 10 64 bit. 所有有问题的计算机都运行Windows 10 64位。 This is the connection code I'm using: 这是我正在使用的连接代码:

Sub SageConnectTest()

Dim oSDO As SageDataObject250.SDOEngine
Dim oWS As SageDataObject250.WorkSpace
Dim oSdc As Object, oSrs As Object
Dim szDataPath As String

Set oSDO = New SageDataObject250.SDOEngine
Set oWS = oSDO.Workspaces.Add("Example")

szDataPath = oSDO.SelectCompany("C:\ProgramData\Sage\Accounts\2019")

If szDataPath <> "" Then
    ' Try to Connect - Will Throw an Exception if it Fails
    If oWS.Connect(szDataPath, XXXX, XXXX, XXXX) Then
        MsgBox "Connection to Sage is Successful!", vbOKOnly + vbInformation, "Sage Connection Test"
    End If
End If

If oSDO.isregistered = True Then
    MsgBox "Sage Data Object is Registered", vbOKOnly + vbInformation, "Sage Connection Test"
    Else
    MsgBox "SDO registration Faliure", vbOKOnly + vbCritical, "Sage Connection Test"
End If

oWS.Disconnect

Exit Sub
Errhandle:
oWS.Disconnect
MsgBox "There was an error connecting to Sage - disconnecting", vbOKOnly + vbCritical, "Sage Connection Test"

End Sub

Googling the problem found a few results that point to a tlb file called 'SdoENG250.tlb' - I've verified that the file is located on the problem machines, but I believe it may need to be registered and I'm not sure how to do that, or even check to see if it is registered. 谷歌搜索问题发现了一些结果,它们指向一个名为'SdoENG250.tlb'的tlb文件-我已验证该文件位于问题计算机上,但我认为可能需要注册该文件,但不确定如何为此,甚至检查它是否已注册。 I'm don't even know if that's the source of the problem at this point. 我什至不知道这是否是问题的根源。

If you are using the 64-bit Version of Office (not Windows!) you need the appropriate Version of the external library. 如果使用的是64位版本的Office (不是Windows!),则需要适当的外部库版本。 If you wrote it yourself, generate a 64-bit version, if it comes from a vendor, consider asking them for a new version MS Docs: Compatibility between the 32-bit and 64-bit versions of Office . 如果您自己编写,请生成一个64位版本,如果它是由供应商提供的,请考虑要求他们提供新版本MS Docs:Office的32位和64位版本之间的兼容性

It seems Sage offers a 64-bit Version of their Add-Ins/Tools, albeit with limited functionality: Sage似乎提供了其加载项/工具的64位版本,尽管功能有限:
Microsoft Office and Sage Accounts, Payroll, HR and Forecasting compatibility Microsoft Office和Sage帐户,薪资,人力资源和预测兼容性
Sage 50 Accounts: Install the 64-bit ODBC driver Sage 50帐户:安装64位ODBC驱动程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM