Mac unique identifier

This code can be useful if you want your code only to work on one Mac.

Sub MachineUniqueIdentifierMac()
'Get the machine unique identifier of a Mac
Dim ScriptToRun As String
Dim Answer As String

ScriptToRun = _
"set uuid to do shell script ""system_profiler SPHardwareDataType" & _
" | awk '/Hardware UUID:/ {print $NF}'"""

On Error Resume Next
Answer = MacScript(ScriptToRun)
On Error GoTo 0

MsgBox Answer

'Or add it to a cell in your worksheet so you can test
'if your workbook is running on the correct machine
'Sheets(1).Range("A1").Value = Answer

End Sub
26-February-2021
Web design by Will Woodgate