PDA

View Full Version : Excel VBA Macro event Workbook_BeforeSave



rvrajendra
02-14-2012, 05:41 AM
Hi All,
I developed an Excel VBA macro. The basic functionality is to disable*save*and instead use*saveas*while trying to save excel.
I used*Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) event.
The macro is working perfectly, forcing users to use*save as*option even though users clicked on*save*button.
The actual problem starts now,
I created a word document and inserted the excel macro as an object inside the word document. When I clicked on the excel in word document it popped a message that to "Enable macros" or "disable macros"
I clicked on "Enable macros". The macro is working fine except while clicking the*save*option, its saving inside the word document, but not forcing to use*save as.*I also found Workbook_BeforeSave event not running while clicking on*save*however when I clicked onSave as, the Workbook_BeforeSave event is running.

Note: I am using Office 2010
Please let me know how to resolve.
Thanks