Hi, everybody! (No, I'm not Doctor Nick. )

I was wondering if someone could help me modify the code of my VBA macro in order to limit execution to just one specific workstation in a shared spreadsheet. The problem is that everyone who has the spreadsheet open will attempt to run the VBA macro when the timer goes off.



Here is the code for the timer to invoke the VBA macro "SaveDate":

Private Sub Workbook_Open()

Application.OnTime TimeValue("00:05:00"), "SaveDate"

End Sub



Here is the actual code for the VBA macro "SaveDate" that is being invoked by the timer:

Sub SaveDate()
    Dim FilePath As String
    Dim NewName As String

    FilePath = "D:\ServerSpreadsheets\": NewName = FilePath & "Inventory Data " & Format(Date, "MMDDYY") & ".xlsm"

    ActiveWorkbook.SaveAs Filename:=NewName, FileFormat _
    :=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub

The goal is to have only the server (workstation name is TwerkingBuddha) be the one to execute the macro, thereby saving it locally without having the other users compete over saving it.

Any help would be greatly appreciated. Thanks!


Regards,
Doctor Lemon