coastie31313
New Member
- Joined
- Jan 11, 2018
- Messages
- 1
Mr. Excel, I am having severe difficulty in getting a "protected" workbook, stored on a shared/network drive to send an email when a user updates the workbook. I have tried many of the VBA codes that you have listed thought out your site with negative results. I can get the email to open but it wants to copy the protected workbook and send it along with the email and then gives me an error. Here is the copy of the code I am using, exactly as you posted. Well almost, though I have not commented out anything. Any chance you can help?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("TargetSheet").Range("TargetRange").Select '#
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Hello, Tvoloria! - the workbook was saved by " & Environ("USERNAME") & " at " & Format(Now(), "ddd dd mmm yy hh:mm")
.Item.To = "Pete.Rooney@bet365.com"
.Item.Subject = "Workbook Saved!"
.Item.display
'.Item.send
End With
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("TargetSheet").Range("TargetRange").Select '#
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Hello, Tvoloria! - the workbook was saved by " & Environ("USERNAME") & " at " & Format(Now(), "ddd dd mmm yy hh:mm")
.Item.To = "Pete.Rooney@bet365.com"
.Item.Subject = "Workbook Saved!"
.Item.display
'.Item.send
End With
End Sub