Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Egidius Bakker   on Oct 02 In MS Office Category.

  
Question Answered By: Francis Riley   on Oct 02

Below my actual code. It was very simple in the end, but I will explain
what had me stumped:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

On Error GoTo Workbook_BeforeSave_Error

ActiveWorkbook.SendMail Recipients:="email.address@...",
Subject:="Raw Mat Database"

On Error GoTo 0
Exit Sub

Workbook_BeforeSave_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure Workbook_BeforeSave of VBA Document ThisWorkbook"
End Sub

------------------------------------------------------------------------
------------------

What I could not understand were the options in the command. Eventually
someone here at work showed me. Select ThisWorkbook in the VBE explorer,
select Workbook instead of General, select the BeforeSave command, add a
line of code, and viola!

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on WorkbookBeforeSave event Or get search suggestion and latest updates.