View Single Post
Old March 13th, 2019, 03:45 AM   #5

turbohamad is offline
Join Date: Jun 2009
Location: Multan
Posts: 49
Hello friends;
I also check the code by using F8 in the VBA editor of the following code

Private Sub CMDREAD_Click()
If OPCServer1 Is Nothing Then 'When OPC server doesn't exist ...
Set OPCServer1 = New OPCServer 'Create instance of OPC Server
OPCServer1.Connect "RSLinx OPC Server" 'Connect to an OPC Server
Set OPCGroup1 = OPCServer1.OPCGroups.Add("MyOPCData")
'Create an OPC group in the OPC Server
OPCGroup1.OPCItems.AddItem"U1C1_Polled]HMI_Analog_Array[4],L113", 1

'OPCGroup1.OPCItems.AddItem "[Topic]Item", ClientHandle
OPCGroup1.IsSubscribed = True 'Receive data whenever it changes
End If
End Sub

start from the IF OPC SERVER1 IS NOTHING after that it goes to END IF.

It means it cannot found the OPC SERVER 1

How i fix it?

  Reply With Quote