Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2003, 06:51 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to prevent Open macros to run

I want to open an Excel-file that contains WorkBook_Open macro.
I know the key SHIFT manually.
But I want to open it programmattically and prevent Open macro to run automatically ??

Thanks

__________________
-vemaju
 
Old December 5th, 2003, 08:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm pretty sure that if you open it programatically using the Excel object library the auto-open macros don't run unless you specifically add another line of code to run them.
 
Old December 5th, 2003, 08:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Auto_nnn macros won't run, but the events will still fire, so if you're being good, and following the new event driven model (eg using Workbook_Open) you have to turn of the event handling before opening.
Code:
Application.EnableEvents = False
...
open files etc
...
Application.EnableEvents = True
And this works for any event with the application

HTH
Chris


There are two secrets to success in this world:
1. Never tell everything you know
 
Old December 5th, 2003, 09:19 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It works fine. Thanks.

 
Old June 7th, 2013, 12:26 PM
Registered User
 
Join Date: Jun 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running a macro from another workbook

Quote:
Originally Posted by chrislepingwell View Post
[...]following the new event driven model (eg using Workbook_Open) you have to turn of the event handling before opening.
Code:
Application.EnableEvents = False
...
open files etc
...
Application.EnableEvents = True
And this works for any event with the application
What is an "event" in VBAspeak?
Is running a macro an "event"?
Is invoking Application.Run an "event"?





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to open IIS console from "Start-Run" menu jayaraj123 ASP.NET 2.0 Professional 16 June 27th, 2012 08:43 AM
VBA Macros not showing up in the run macro menu d.lee84 Access VBA 9 August 21st, 2007 09:37 AM
Open Form, run query, open form Grafixx01 Access 7 April 26th, 2007 11:32 AM
Run-time error '20599'; Cannot open SQL Server manishashar888 Pro VB Databases 7 March 20th, 2007 07:04 AM
How to Run Excel Macros from ASP asptest Classic ASP Databases 7 September 13th, 2006 10:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.