AW: Per VBA prüfen, ob PC online ist!
12.02.2004 10:34:55
Michael S.
Ersteinmal DANKE für Deine Antwort!
Leider komme ich damit noch nicht ganz zurrecht. Vielleicht könntest Du mir noch ein paar Tips geben?
Dieser Code steht bei mir:
Private Sub CommandButton5_Click()
Worksheets("oanda (2)").Range("A1").QueryTable.Refresh BackgroundQuery:=False
End Sub
Dieser Code steht auf der Internetseite:
'Example:
' IsConnected
' If Connect = True Then MsgBox "I'm Connected."
' If Connect = False Then MsgBox "I'm Not Connected."
'Just Add The Rest Of This To The Form's Declarations
Private Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
Private Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
'
Private Const RAS95_MaxEntryName = 256
Private Const RAS95_MaxDeviceType = 16
Private Const RAS95_MaxDeviceName = 32
'
Private Type RASCONN95
dwSize As Long
hRasCon As Long
szEntryName(RAS95_MaxEntryName) As Byte
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
'
Private Type RASCONNSTATUS95
dwSize As Long
RasConnState As Long
dwError As Long
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Dim laststausOn As Boolean
Dim connect As Boolean
Private Function IsConnected() As Boolean
Dim TRasCon(255) As RASCONN95
Dim lg As Long
Dim lpcon As Long
Dim RetVal As Long
Dim Tstatus As RASCONNSTATUS95
TRasCon(0).dwSize = 412
lg = 256 * TRasCon(0).dwSize
RetVal = RasEnumConnections(TRasCon(0), lg, lpcon)
If RetVal <> 0 Then
MsgBox "ERROR"
Exit Function
End If
Tstatus.dwSize = 160
RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)
If Tstatus.RasConnState = &H2000 Then
IsConnected = True
connect = True
Else
IsConnected = False
connect = False
End If
End Function
Wenn ich den bei mir einfüge, dann klappt das so nicht - ich denke, dass man den noch anpassen muß. Leider weiß ich nicht wie!?!?!
Könntest Du mir da weiterhelfen????
Vielen vielen Dank!
Michael