ayman metwally
Lifetime Supporting Member
Sorry, Correcting the code (cancel my last post):
Notes:
1- Form_name is the form that contains the OPC client Active X control.
2- If I still remember, The variable that contains the value to be written in the PLC (i.e. VarValue = "Group.Subgroup.item") must be Variant type.
Also read the articles in This link. You will find very useful information.
Best regards.
Code:
Private Sub Command1_Click()
Dim [COLOR=red]VarName[/COLOR] As String
Dim [COLOR=blue]VarValue[/COLOR] As Variant
[COLOR=red]VarName[/COLOR] = "Group.Subgroup.item"
[COLOR=blue]VarValue[/COLOR] = 0 [COLOR=green]' Or 1[/COLOR]
result = Form_name.OPCData1.WriteVariable([COLOR=red]VarName[/COLOR], [COLOR=blue]VarValue[/COLOR], 0)
End Sub
1- Form_name is the form that contains the OPC client Active X control.
2- If I still remember, The variable that contains the value to be written in the PLC (i.e. VarValue = "Group.Subgroup.item") must be Variant type.
Also read the articles in This link. You will find very useful information.
Best regards.