In Excel VBA, you will need a module, you can call it whatever. One public function to set the toggle like so. You will need to set the Constant 'test' to the mac address of the PC you want to allow access for
Public Function notmacaddress()
Dim m As String
Const test = "MM:MM:MM:SS:SS:SS"
m = GetMACAddress
If m <> test Then
notmacaddress = True
Else
notmacaddress = False
End If
End Function
And a private function to get the mac address of the PC attempting to open the workbook
Function GetMACAddress() As String
Dim sComputer As String
Dim oWMIService As Object
Dim cItems As Object
Dim oItem As Object
Dim myMacAddress As String
sComputer = "."
Set oWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set cItems = oWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each oItem In cItems
If Not IsNull(oItem.IPAddress) Then myMacAddress = oItem.macAddress
Exit For
Next
'it will return mac address in format MM:MM:MM:SS:SS:SS
GetMACAddress = myMacAddress
End Function
Then in the open event of the workbook add the code
Private Sub Workbook_Open()
If notmacaddress Then
ThisWorkbook.Close
End If
End Sub
Oh and reference to the Get mac address function here