JLand
Member
Folks,
I have an issue with my Excel VBA. When I run the upload script from my machine (Win10 Office 2016) it runs fine. But when I run it from a client's server (WinServer 2012 Office 2010) or the client runs it on his machine (Win10 Office 2010) it returns the following error:
I am basically at the end of my ability to figure this out. I have ran SFC, reregistered Excel, and I believe all DLLs are where they should be (I could be wrong here).
Can anyone help?
Here is the code I am debugging (not my code, BTW). Bolded is the line debugger takes me to:
Thank you so much for taking the time to read this!
I have an issue with my Excel VBA. When I run the upload script from my machine (Win10 Office 2016) it runs fine. But when I run it from a client's server (WinServer 2012 Office 2010) or the client runs it on his machine (Win10 Office 2010) it returns the following error:
Run-time error '429':
ActiveX component can't create object
I am basically at the end of my ability to figure this out. I have ran SFC, reregistered Excel, and I believe all DLLs are where they should be (I could be wrong here).
Can anyone help?
Here is the code I am debugging (not my code, BTW). Bolded is the line debugger takes me to:
Code:
Dim MyServer As OPCServer
Dim MyGroup As OPCGroup
Dim lNumItems As Long ' defines the number of items to be added, read or writen
Dim arSvrHandles() As Long ' array to contain the server handles, used to write, or remove an item. this array it redim'ed and returned by the additems procedure
Dim arClHandles() As Long ' array to contain the client handles, used to read and add items. This array needs to be redim'ed and populated before it can be used
Dim arErrors() As Long ' array to store errors returned by the varrious OPC Automation procedure calls
Dim lTransID As Long ' transaction id for async I/O opporations
Dim lCancelID As Long ' cancel id for async I/O opportations
Const OpcDsCashe As Long = 1 ' used in the OPC read functions, causes the read to take data from the RSlinx Cashe
Const OpcDsDevice As Long = 2 ' used in the OPC read functions, caused the read to take data directly from the device.
Public Function OpcConnect(ByVal MyGroupName As String, ByRef Items() As String) As Boolean
lNumItems = UBound(Items) - (LBound(Items) - 1) ' determine the number of items to read
ReDim arClHandles(1 To lNumItems) As Long ' redim then build the client handles array
For j = 1 To lNumItems
arClHandles(j) = j
Next j
Set MyServer = New OPCServer ' create the opc server object
[B]MyServer.Connect "RSLinx OPC Server" ' connect to the opc server[/B]
Set MyGroup = MyServer.OPCGroups.Add(MyGroupName) ' create the group object
MyGroup.IsActive = False ' set the group to inactive then add items
MyGroup.IsSubscribed = False
MyGroup.UpdateRate = 500 ' set the group to read data every 500 ms
MyGroup.OPCItems.AddItems lNumItems, Items, arClHandles, arSvrHandles, arErrors ' add the requested items to the opc server
MyGroup.IsSubscribed = False ' by setting IsSubscribed = true, you enable asyncrous I/O commands
lTransID = 0 ' initilize the transaction id
lCancelID = 0 ' initilize the cancel id
If MyGroup.OPCItems.Count <> lNumItems Then
OpcConnect = False
lNumItems = MyGroup.OPCItems.Count
Else
OpcConnect = True
End If
End Function
Thank you so much for taking the time to read this!