Reputation: 495
My users use VPN to connect to our network. When they disconnect from the VPN and reconnect the network drive also disconnects till they open the drive or folder through file explorer. When this happens and they don't re-establish the connection to the network drive they end up with 3304 error.
I'd like to set up an error handler to tell them what happened with a potential link they could click on to re establish the connection.
Or even better identify that error has occurred and re-establish the connection and no error pop up.
On Error GoTo ErrHandler
'Error Handler
ErrHandler:
If Err.Number = 3304 Then
MsgBox "Error Number:" & Err.Number & vbCrLf & _
"Error Description: " & Err.Description & vbCrLf & _
"This error is due to your VPN being disconnected and reconnected"
Else
End If
Upvotes: 0
Views: 125
Reputation:
We faced that issue a couple months ago. We took the route of actually just showing an informative MsgBox to tell the users what to do to solve by themselves calling a function into the 'Workbook_Open' event that fails if a Central Code for the Company its not found with the Dir() function:
Function IsVPNOn(ByVal strCentralCodePath As String) As Boolean
Dim retBoolean As Boolean
On Error Resume Next
If IsError(Dir(strCentralCodePath & g_strCentralCodeName)) Then
MsgBox "The VPN seems to be disconnected." & vbCr & vbCr & _
"Please check VPN connection if Company toolbar is needed.", _
vbCritical + vbOKOnly, "Company Ribbon"
retBoolean = False
Else
retBoolean = True
End If
IsVPNOn = retBoolean
End Function
Not gonna lie, the second option with skipping and reconnecting without the user being even aware of the problem seems more classy, but it is way trickier as you have to deal with connections inside your code.
Upvotes: 1