Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping Excel Macros when started from VB

Status
Not open for further replies.

BillDickenson

IS-IT--Management
Mar 21, 2005
29
0
0
US
I am calling Excel from Access and I need to disable the macro functions on start. They are causing me to have an extra prompt at the save.

I don't want to delete the macros, just stop them from processing and stop the system from prompting me !
 
Are you talking about code in an Auto_Open sub, the workbooks Open event, or all the code in the workbook?

VBAjedi [swords]
 
Actually, all code. Since I'm opening this up from Access, I get that annoying "do you want to save changes" after I have saved. On investigating this, I found out that it happens "live" as well because the existance of a macro forces excel to prompt.

when I open it "live" i get the option of running macros. I'd like to do the same thing except say "no".

Thanks
 
One of past threads on disabling macros in excel: thread707-639337. Actually, the only thing you can do with this is locking of event macros and/or running code by user.
The prompt for saving workbook is caused by excel itself, to disable it you need to use automation and code the operation of closing workbook.
You can start with 'Saved' property and 'Close' method of workbook object in excel vba help.

combo
 
Use application.enableevents = false

disables all events (workbook_open etc)

DON'T forget to set it back to true again, it's one of those settings that doesn't turn itself back on again automatically...

use application.displayalerts = false to turn the save questions etc off. Same thing there (I think), turn them on again.

// Patrik
______________________________

To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the IT Professional, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top