Private Sub Command1_Click() '電機啟動
Dim a As Integer
Dim b As Integer
b = 0
a = MsgBox("是否在啟動電機時就啟動監(jiān)視功能并進入曲線監(jiān)控畫面", 4, "監(jiān)控選擇")
If a = 6 Then
'曲線監(jiān)控.Visible = True
If qxstart_flag = False Then
Set 曲線監(jiān)控.s = CreateObject("Excel.Application")
'曲線監(jiān)控.s.Visible = True
Set 曲線監(jiān)控.exwbook = Nothing
Set 曲線監(jiān)控.exsheet = Nothing
Set 曲線監(jiān)控.exwbook = 曲線監(jiān)控.s.workbooks.open("d:/vb98/3-1.xls")
Set 曲線監(jiān)控.exsheet = 曲線監(jiān)控.exwbook.Worksheets("sheet1")
qxstart_flag = True
End If
曲線監(jiān)控.Visible = True
曲線監(jiān)控.Timer1.Enabled = True
End If
Do While Form1.complish = True
a = 0
Loop
Form1.complish = True
a = Form1.forcem_y("m0", 1)
Do While b < 10000
b = b + 1
Loop
Do While Form1.complish = True
a = 0
Loop
Form1.complish = True
a = Form1.forcem_y("m0", 0)
End Sub
上面是我寫的電機啟動代碼,上升沿置啟動指令,下降沿置M8122發(fā)送請求