MCGS和VB上位机做OLE通讯, 随笔记录:
Dim DatObj As Object
Private Sub From_Load()
On Error Resume Next
Set DatObj = GetObject(, "McgsRun.DataCentre")
If Err Then
MsgBox ("请先启动MCGS运行环境!")
End
End If
End Sub
Private Sub Cmd_Read_Click()
Dim msg As String, tt As Variant
For i = 1 To 10
msg = "Dat" + Fromat$(i, "00")
DatObj.GetValueFromName msg, tt
Txt(i) = Fromat$(tt)
Next i
End Sub
读数据成功, 搞定!