ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Alert When A Document is Changed (https://www.excelbanter.com/excel-worksheet-functions/188704-alert-when-document-changed.html)

robzrob

Alert When A Document is Changed
 
Is there any mechanism in Microsoft Office which will send an email
when an Excel (or Word) document has been amended?

ryguy7272

Alert When A Document is Changed
 
This will record a user's ID each time Excel file is opened:
Private Sub Auto_Open()

LogInformation ThisWorkbook.Name & " opened by " & _
Application.UserName & " " & Format(Date, "yyyy-mm-dd") & " " &
Format(Time, "hh:mm")
'LogInformation Variable1 & "," & Variable2 & "," & Now

End Sub

Sub LogInformation(LogMessage As String)
Const LogFileName As String = "C:\MyLog.txt"
Dim FileNum As Integer
FileNum = FreeFile ' next file number
Open LogFileName For Append As #FileNum ' creates the file if it doesn't
exist
Print #FileNum, LogMessage ' write information at the end of the text file
Close #FileNum ' close the file
End Sub

Notice, you must have a Text file named 'MyLog.txt' at this location:
"C:\MyLog.txt"


Regards,
Ryan--

--
RyGuy


"robzrob" wrote:

Is there any mechanism in Microsoft Office which will send an email
when an Excel (or Word) document has been amended?



All times are GMT +1. The time now is 02:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com