PDA

View Full Version : Solved: Calling a Macro from an OPC linked cell



Unmotiv8d
04-15-2008, 06:34 AM
I'm having a problem getting a macro to run from a value generated from an OPC link into a PLC program. The OPC link will display a number of either 0 or 1. The macro will run when I manually populate the cell with a 1 but not when the value is coming from the OPC link. Below is the script I'm using to call the macro along with a sample of the OPC link that I'm using. The value of the cell is being displayed as a simple number. Any help I could get would be greatly appreciated.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("check").Address Then
If Target = 1 Then
Call VerSaveAs
End If
If Target = 1 Then
Call Emailer("Team Ripsaw Report", "Team Ripsaw Report", ActiveWorkbook.FullName)
End If
End If
End Sub

MS Excel 2000 SR1

OPC Link {=RSLINX|piron!'T40:19.TT,L1,C1'}

Thanks Again

Bob Phillips
04-15-2008, 06:37 AM
Try putting the code in worsheet calculate event, and set a refernec in the worksheet to the check cell so that calculate getes triggered.

Unmotiv8d
04-15-2008, 07:30 AM
Thanks for the reply. I have set up a calculate in another cell and I'm still unable to trigger the event. Sorry if I'm being dense but I may need a little more hand holding...thanks.