excel macro to track changes in a folder
excel macro to track changes in a folder
(OP)
I am trying to use excel to track changes in a folder, if possible. every time someone updates a file, copy-pastes a new file or does any kind of change in that folder,excel would track it to generate an email and send it saying that a chance occured. my starting point is the code below, which I had used to track changes in a spreadsheet; wonder if i can build on it. any help is appreciated.
regards..
CODE:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim OLook As Object 'Outlook.Application
Dim Mitem As Object 'Outlook.Mailitem
Dim SendAnEmail As Boolean
Dim strBody As String
strBody = "Address = " & Target.Address & vbNewLine
strBody = strBody & Range("$a$" & Target.Row) & " = " & Target
'MsgBox strBody
'Exit Sub
If Not Intersect(Target, Range("A1:AK2000")) Is Nothing Then
Set OLook = CreateObject("Outlook.Application")
Set Mitem = OLook.createitem(0)
Mitem.to = "add email address here"
Mitem.Subject = "add subject here"
Mitem.body = strBody
Mitem.send
End If
End Sub
regards..
CODE:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim OLook As Object 'Outlook.Application
Dim Mitem As Object 'Outlook.Mailitem
Dim SendAnEmail As Boolean
Dim strBody As String
strBody = "Address = " & Target.Address & vbNewLine
strBody = strBody & Range("$a$" & Target.Row) & " = " & Target
'MsgBox strBody
'Exit Sub
If Not Intersect(Target, Range("A1:AK2000")) Is Nothing Then
Set OLook = CreateObject("Outlook.Application")
Set Mitem = OLook.createitem(0)
Mitem.to = "add email address here"
Mitem.Subject = "add subject here"
Mitem.body = strBody
Mitem.send
End If
End Sub





RE: excel macro to track changes in a folder
think about this . . . basically, the program would need to be executed periodically to check all files in a folder.
anytime a file is saved, the computer's date/time is used to identify when the file was modified or created. what is wrong with checking the folder itself and sorting the files by date/time properties. of course, the computer's time needs to be confirmed.
good luck!
-pmover
RE: excel macro to track changes in a folder
i mean you could schedule a run of Windows Explorer, output to a file, and run "difference".
is there a way to have Windows tell you that it's updated a file, maybe within Windows security settings ?
RE: excel macro to track changes in a folder
http://www.tek-tips.com/threadminder.cfm?pid=707
You will find the interface at that forum is identical to eng-tips.... it's run by the same people.
=====================================
Eng-tips forums: The best place on the web for engineering discussions.
RE: excel macro to track changes in a folder
RE: excel macro to track changes in a folder
http://
-handleman, CSWP (The new, easy test)
RE: excel macro to track changes in a folder
-handleman, CSWP (The new, easy test)
RE: excel macro to track changes in a folder
Cheers,
Joerd
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: excel macro to track changes in a folder