Private Sub ChkPorts()
Dim intCanal As Integer
Dim int1 As Integer
On Error GoTo Err_PtoPar
For int1 = 1 To 16
intCanal = FreeFile
Open "LPT" & int1 For Input As intCanal
Close intCanal
Next int1
PtoCom:
On Error GoTo Err_PtoCom
For int1 = 1 To 16
intCanal = FreeFile
Open "COM" & int1 For Input As intCanal
Close intCanal
Next int1
Exit Sub
Err_PtoPar:
If Err.Number = 53 Then
MsgBox int1 - 1 & " puerto(s) paralelo(s)"
Resume PtoCom
End If
Exit Sub
Err_PtoCom:
If Err.Number = 53 Then MsgBox int1 - 1 & " puerto(s) com"
End Sub