RunFromShared

Check is this VBA-Excel file is running from a shared folder (Starts with \\)
Then shows a message to user, and exits tool or not is caller asked

CodeFunctionName
What is this?

Public

Tested

Original Work
Function RunFromShared(Optional Msg = "", Optional ThenExit = 1) As Boolean
' Check if file is ran from shared folder (starts with "\\")
RunFromShared = False
mypath = ThisWorkbook.Path
If InStr(1, mypath, "\AppData\Local\", vbTextCompare) > 0 Then
If Msg = "" Then Msg = "You may not run this tool from a shared location" & _
vbCrLf & "Please copy to your local drive then run"
MsgBox Msg
If ThenExit = 1 Then ThisWorkbook.Close False
End If
End Function

Optional Msg, Optional ThenExit

Views 3,240

Downloads 1,387

CodeID
DB ID