Home ยป excel ยป vba – Track copying excel file

vba – Track copying excel file

Posted by: admin May 14, 2020 Leave a comment

Questions:

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
    Else
        ' do stuff for Save
    End If
End Sub