Industry Online Support
Technical Forum
11/12/2021 8:38 AM | |
Joined: 2/22/2006 Last visit: 7/3/2024 Posts: 290 Rating: (37) |
Hi, I need to read data from WinCC OPC DA server into Excel table. WinCC and Excel are on the same computer. Microsoft Office installed is Office 2016 x86 (32-bit application). WinCC is v7.4 SP1 Upd13. I am using Microsoft Windows 10.0 (Build 10240) Enterprise 2015 LTSB. I tested on two PCs with the same result! To have OPC functionality, I am using OPC DA Automation Wrapper 2.02, installed in C:\Windows\SysWOW64\opcdaauto.dll. Installed ie 32 bit version of Microsoft Office, because 64 bit version, do not support Automation! My code is very simple: Sub mySub() Dim myOPCserver As OPCServer Dim AllOPCServers As Variant Dim sProdID As String, sNode As String sProdID = "OPCServer.WinCC.1" sNode = "127.0.0.1" Set myOPCserver = New OPCServer AllOPCServers = myOPCserver.GetOPCServers myOPCserver.Connect sProdID 'AllOPCServers(3) 'myOPCserver.Disconnect Debug.Print Err.Description Set myOPCserver = Nothing End Sub I can create OPCServers object and can execute some methods (GetOPCServers for example). When I execute myOPCserver.GetOPCServers, I get the list of availabe OPC DA servers. As soon as I execute "myOPCserver.Connect sProdID", the VBA script stops, and the objects and variable disappears from Locals window (you can see attachment). I experiment with or without "Node" parameter. Nothing helps, as soon as I execute Connect method, the execution stops. Does someone got similar problem? How you sorted it out? Regards, Svetozar Yolov
AttachmentVBA - OPC DA.zip (145 Downloads) |
Follow us on