Are there any VBA code to look for a present internet connection?
I have a code that will run on a timer. This code will open a file on a local network share drive.
You can check the Len
of Dir
on the shared drive you're trying to get to:
Option Explicit
Sub TestForNetworkDrive()
'suppose the file we want is at Z:\cool\vba\files\file.txt
If Len(Dir("Z:\cool\vba\files\file.txt")) = 0 Then
'handle network not available issue
MsgBox ("Network share not found...")
Else
'do timer-based code here
MsgBox ("Let's get to work!")
End If
End Sub