youngEIT
Civil/Environmental
- Jan 4, 2008
- 87
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