Woorkbook_Open but disable macros

T

Trevor

I have written a macro which opens other files. When those other files
open, though, I do not want their macros to run (they all have code in
Workbook_Open that I would like to ignore).


Background: I have a spreadsheet that keeps track of my business expenses
for each calendar quarter. Each spreadsheet is made from the same blank
spreadsheet which I created as a sort of template. The spreadsheets are al
formated with validation and formulas, etc. All have Workbook_Open macros
which add an "Expense" menu, with "Add Expense" and "Sort Expense" menu
items. Each workbook contains 2 worksheets: one for the actual expenses and
the other for a summary of expenses in each category.

The problem is that in the Q4 file, I have columns for the expenses from
each of the other 3 files (as INDIRECT formulas referencing the other
files). So in my Q4 Workbook_Open macro, I open the other 3 files so the
formulas resolve. But I don't want to see 3 more Expense menus.
 
C

Chip Pearson

Turn off event handling. E.g.,

Application.EnableEvents = False
' open the workbooks
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top