Home » excel » vba – Track copying excel file

vba – Track copying excel file

Posted by: admin May 14, 2020 Leave a comment


Is it possible to track if anyone saving as an excel file using VBA?

Thank you 🙂

How to&Answers:

Yes it is possible.

Use the Workbook.BeforeSave Event which occurs before the workbook is saved.

Then write a log in whatever way you prefer. Eg log into a text file or in a worksheet of the workbook itself.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If SaveAsUI Then
        ' do Stuff for SaveAs
        ' do stuff for Save
    End If
End Sub