I modified this from an Internet Search. It tests to see if the user is connected to a company network. It works, but the first time I run it, whether connected to network or not, it takes about 27 seconds - VERY SLOW! Then each time, it is almost instant. Anyway to speed the initial runtime up?
I've also tried this, which seems to do a little better, but still long delay on first attempt:
Code:
Sub checkmynetwork()
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("\\24.224.224.224\DATA\HOME") Then
MsgBox "Connected to network, Use Internal IP Address"
Else
MsgBox "Not connected to network, Use External IP Address"
End If
End Sub
I've also tried this, which seems to do a little better, but still long delay on first attempt:
Code:
Sub checkmynetwork2()
Dim FSO As Scripting.FileSystemObject
Dim FolderPath As String
Set FSO = New Scripting.FileSystemObject
FolderPath = "F:\HOME\"
If Right(FolderPath, 1) <> "\" Then
FolderPath = FolderPath & "\"
End If
If FSO.FolderExists(FolderPath) = False Then
MsgBox "Not connected to network, Use External IP Address"
Else
MsgBox "Connected to network, Use Internal IP Address"
End If
End Sub