Control KMtronic relays via EXCEL

 

KMtronic USB One Relay Microsoft Excel Control

 

Download example file from:

www.info.kmtronic.com/software/USB_Relays/KMtronic-Excel-USB-Relay-Control.zip

     Only for 32bit OS!

For 64 bit OS download this example:

 

www.info.kmtronic.com/software/USB_Relays/KMtronic-Excel-USB-Relay-Control-64bit.zip

 

 

Copy 'NETComm.ocx' and 'MSCOMM32.OCX' to C:\Windows\System 

 

Open Command Prompt:  Start ->type cmd in search field -> press Enter

 

Type "regsvr32 C:\Windows\System\NETComm.ocx" and ENTER

Type "regsvr32 C:\Windows\System\MSCOMM32.OCX" and ENTER

 

 

Control KMtronic relays via EXCEL

 

 

Open "KMtronic-Excel-USB-Relay-Example.xls" and "Enable Macros"

 

Control KMtronic relays via EXCEL

 

Set COM port and type "1" A1 cell

 

Control KMtronic relays via EXCEL

 

 

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If IsNumeric(Target) Then
On Error Resume Next
On Error GoTo 0
UserForm1.Show
End If
End If
End Sub

Private Sub UserForm_Activate()
MSComm1.CommPort = Sheets("Sheet1").Range("F1").Value
MSComm1.PortOpen = True
MSComm1.Output = Chr$(255) + Chr$(1) + Chr$(Sheets("Sheet1").Range("A1").Value)
MSComm1.PortOpen = False
Unload UserForm1
End Sub

 

 

 

 

 

 

 

 

 

Read 26211 times