Gast
#697080
Hallo,
ich habe folgende Funktion, das Ergebnis dieser Funktion möcht ich in so
einem Drop Down Menü (ComboBox) ausgeben, nur wie bring ich den Inhalt
da hinen, ich versteh die Funktion nicht ganz.
Die Funktion fragt ab welche seriellen Schnittstellen verfügbar sind!
Hier der Code:
Public Function CommPortsAvail(ByRef MSComm As MSComm, _
Optional ByVal FreePortsOnly As Boolean _
) As Variant
Dim lPorts() As Integer
Dim lPort As Integer
Dim l As Integer
On Error Resume Next
With MSComm
For lPort = 1 To 16
.CommPort = lPort
.PortOpen = True
If (Err.Number <> comPortInvalid) Then
If Not (FreePortsOnly And _
Err.Number = comPortAlreadyOpen) Then
ReDim Preserve lPorts(l)
lPorts(i) = lPort
l = l + 1
End If
End If
If (.PortOpen) Then
.PortOpen = False
End If
Err.Clear
Next
End With
CommPortsAvail = lPorts()
End Function