VB to send command to arduino

This is the VB6 code I use to find the com port the Arduino is on:

For n = 1 To 16
  If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
   On Error Resume Next
   MSComm1.CommPort = n
   On Error Resume Next
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
   If MSComm1.CommID > 0 Then
     For i = 1 To 100  'keep trying
      str = ""
      str = MSComm1.Input

 
      If InStr(str, "< ") > 0 And InStr(str, ">") > 0 Then GoTo jump:

     ' these are the chars I use to bracket the output from the Arduino 
     ' you can use anything you want
     ' the reason I do this is so the VB can tell the Arduino port 
     'from other active ports otherwise the code
     ' will just pick the first one open
                                                                                  
      Sleep 50                                                                                       
     Next i
  End If
Next n
If MSComm1.PortOpen = False Then MsgBox "Controller Not functioning , Please check USB connection", vbCritical, "": ComFail = True: Exit Sub