PC Review


Reply
Thread Tools Rate Thread

Auto_Open over Private Sub Workbook_Open()

 
 
ordnance1
Guest
Posts: n/a
 
      29th May 2010
I am just wondering, is there any advantage to using an Auto_Open module
over just placing that code in a Private Sub Workbook_Open() module under
ThisWorkbook?

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      30th May 2010
I find that explaining how to use Auto_Open is easier than explaining how to use
workbook_open.

But to me, they're pretty much interchangeable.

There are some things (creating an application event, for example) that makes
the workbook_open a more logical choice.

And there are differences in behavior.

If you use one macro to open another workbook, then you have to stop the
workbook_open event from firing (if you don't want it to run)

application.enableevents = false
set wkbk = workbooks.open(filename:=...
application.enableevents = true

On the other hand, if you want to run the auto_open procedure, you'll have to
run it explicitly (using someworkbookthatjustopened.RunAutoMacros
which:=xlAutoOpen.runautomacros

They're kind of opposite in behavior.



ordnance1 wrote:
>
> I am just wondering, is there any advantage to using an Auto_Open module
> over just placing that code in a Private Sub Workbook_Open() module under
> ThisWorkbook?


--

Dave Peterson
 
Reply With Quote
 
ordnance1
Guest
Posts: n/a
 
      30th May 2010
Thanks

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I find that explaining how to use Auto_Open is easier than explaining how
> to use
> workbook_open.
>
> But to me, they're pretty much interchangeable.
>
> There are some things (creating an application event, for example) that
> makes
> the workbook_open a more logical choice.
>
> And there are differences in behavior.
>
> If you use one macro to open another workbook, then you have to stop the
> workbook_open event from firing (if you don't want it to run)
>
> application.enableevents = false
> set wkbk = workbooks.open(filename:=...
> application.enableevents = true
>
> On the other hand, if you want to run the auto_open procedure, you'll have
> to
> run it explicitly (using someworkbookthatjustopened.RunAutoMacros
> which:=xlAutoOpen.runautomacros
>
> They're kind of opposite in behavior.
>
>
>
> ordnance1 wrote:
>>
>> I am just wondering, is there any advantage to using an Auto_Open module
>> over just placing that code in a Private Sub Workbook_Open() module under
>> ThisWorkbook?

>
> --
>
> Dave Peterson


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook_Open vs Auto_Open Bongard Microsoft Excel Programming 4 24th Feb 2009 04:47 PM
Auto_Open Workbook_Open yngve.angelskaar@fusi.no Microsoft Excel Programming 4 2nd Nov 2005 08:20 PM
Cannot get Auto_Open or Private Sub Workbook_Open() to run at star =?Utf-8?B?UGF1bCBNb2xlcw==?= Microsoft Excel Programming 0 28th Oct 2004 03:53 PM
Auto_Open and Workbook_Open Erich Neuwirth Microsoft Excel Programming 1 14th Jul 2004 01:19 AM
Auto_Open Vs Workbook_open Soniya Microsoft Excel Programming 2 23rd Sep 2003 03:56 PM


Features
 

Advertising
 

Newsgroups
 


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