16 再看一个WithEvents例子

代码写在ExcelVBA里  要求打开一个pdi,上面有一个Val1

Dim WithEvents valX As PBSymLib.Value
Dim pbkX As PBObjLib.Application

Private Sub valX_DataUpdate()
AppActivate "Microsoft Excel"
MsgBox  1
End Sub

Private Sub Workbook_Open()

Set pbkX = GetObject(, "piprocessbook.application")
Set valX = pbkX.ActiveDisplay.Symbols.Item("val1")

End Sub

只要pdi数据变化  Excel就msg 一个1 出来

posted on 2006-06-06 11:59  zljini  阅读(501)  评论(0编辑  收藏  举报