Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA capture File SaveAs Event
In an Excel VBA application, when the user selects File
from the toolbar then File SaveAs, I want to capture that event. If that's not possible, If I could at least capture the event when they select File from the toolbar that would help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA capture File SaveAs Event
One way:
In the ThisWorkbook code module of your workbook: Private Sub Workbook_Activate() Application.CommandBars("Worksheet menu bar").Controls( _ "File").Controls("Save As...").OnAction = "mymacro" End Sub Private Sub Workbook_Deactivate() Application.CommandBars("Worksheet menu bar").Controls( _ "File").Controls("Save As...").Reset End Sub where "mymacro" is a macro in a regular code module. In article , "Linda Mcfarlane" wrote: In an Excel VBA application, when the user selects File from the toolbar then File SaveAs, I want to capture that event. If that's not possible, If I could at least capture the event when they select File from the toolbar that would help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA capture File SaveAs Event
Another option might be to catch the SaveAs inside the workbook_beforesave
event. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If SaveAsUI Then MsgBox "using SaveAs" 'do what you want Cancel = true 'stop that save! End If End Sub You can read a lot more about events at Chip Pearson's site: http://www.cpearson.com/excel/events.htm Linda Mcfarlane wrote: In an Excel VBA application, when the user selects File from the toolbar then File SaveAs, I want to capture that event. If that's not possible, If I could at least capture the event when they select File from the toolbar that would help. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Capture the hyperlink event before it goes to the link | Excel Discussion (Misc queries) | |||
Excel screen capture to capture cells and row and column headings | Excel Discussion (Misc queries) | |||
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met | Excel Discussion (Misc queries) | |||
saveas CSV file | Excel Discussion (Misc queries) | |||
Capture event when exit Column G | Excel Discussion (Misc queries) |