1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Set appExcel = CreateObject("Excel.Application")
Set WbExcel = appExcel.Workbooks.Open("C:\essai5.xls")
Set WsExcel = WbExcel.Worksheets(1)
i = 1
While WsExcel.Cells(i, 1).Value <> Empty
i = i + 1
Wend
ReyProgressBar1.Visible = False
'--------------------------------------------- PLC ----------------------------------
With CPUComm
.CommPort = 3
.Handshaking = 0
.RThreshold = 5
.RTSEnable = True
.Settings = "9600,e,7,2"
.SThreshold = 5
If .PortOpen = True Then
.PortOpen = False
.PortOpen = True
End If
End With
If CPUComm.PortOpen = False Then
CPUComm.PortOpen = True
End If
Private Sub ReyCommand1_Click()
If CPUComm.PortOpen = False Then
CPUComm.PortOpen = True
End If
If CPUComm.PortOpen = True Then
ReyCommand1.BackColor = "&H0000FF00"
ReyCommand1.Caption = "Port ouvert"
ReyCommand2.BackColor = "&H00C0C0C0"
ReyCommand2.Caption = "Fermer la communication"
End If
Text1.SetFocus
Text1.SelStart = 0
End Sub |
Partager