22 November 2017

Excel VBA Only Allow Workbook To Run From Specific Location


Check current workbook link and compared to custom address


Sub Success()

'check current path
Path = ActiveWorkbook.Path
'Range("A1") = ActiveWorkbook.Path


'if current path not same, exit
If Path <> "C:\Users\othmmohd\Desktop" Then
MsgBox "Please use Jobs in Lab - Macro from shared drive."
ThisWorkbook.Close savechanges:=False
End If

End Sub

No comments: