Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture the hyperlink event before it goes to the link Korekiyo Baisotei Excel Discussion (Misc queries) 0 September 25th 08 05:53 AM
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met JMay Excel Discussion (Misc queries) 2 June 17th 07 04:37 PM
saveas CSV file stevekirk Excel Discussion (Misc queries) 0 August 10th 06 01:11 PM
Capture event when exit Column G zSplash Excel Discussion (Misc queries) 2 December 27th 04 05:28 PM


All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"