ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check online network availability (https://www.excelbanter.com/excel-programming/324413-check-online-network-availability.html)

[email protected]

Check online network availability
 
Hi Friends

I want to establish, if the user is on-line with the network
fileserver. Scroll drives or using FileExist method (File Scripting
object) wont do the trick, because the path will often, but not always,
be available offline. I've got to know if they are connected - any
idea's?
Thanks/Mike


AA2e72E

Check online network availability
 
Try:

Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags
As Long) As Long

Sub xx()
Select Case IsNetworkAlive(0)
Case 0
MsgBox "not connected"
Case 1
MsgBox "connected to LAN"
Case 2
MsgBox "connected to WAN"
Case Else
MsgBox "connected to ?other network?"
endselect
End Sub

You probably want to verify whether IsNetWorkAlive returns 0 or nonzero only.

" wrote:

Hi Friends

I want to establish, if the user is on-line with the network
fileserver. Scroll drives or using FileExist method (File Scripting
object) wont do the trick, because the path will often, but not always,
be available offline. I've got to know if they are connected - any
idea's?
Thanks/Mike



Jim Thomlinson[_3_]

Check online network availability
 
Very Cool. Thanks. I have no need for it right now, but it should come in
handy at some point in my life...

"AA2e72E" wrote:

Try:

Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags
As Long) As Long

Sub xx()
Select Case IsNetworkAlive(0)
Case 0
MsgBox "not connected"
Case 1
MsgBox "connected to LAN"
Case 2
MsgBox "connected to WAN"
Case Else
MsgBox "connected to ?other network?"
endselect
End Sub

You probably want to verify whether IsNetWorkAlive returns 0 or nonzero only.

" wrote:

Hi Friends

I want to establish, if the user is on-line with the network
fileserver. Scroll drives or using FileExist method (File Scripting
object) wont do the trick, because the path will often, but not always,
be available offline. I've got to know if they are connected - any
idea's?
Thanks/Mike




All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com