Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Auto_Open over Private Sub Workbook_Open()

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Auto_Open over Private Sub Workbook_Open()

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Auto_Open over Private Sub Workbook_Open()

Thanks

"Dave Peterson" wrote in message
...
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
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
Auto_open OR Workbook_open Baapi Excel Programming 2 November 15th 06 03:39 PM
Auto_Open Workbook_Open [email protected] Excel Programming 4 November 2nd 05 08:20 PM
Cannot get Auto_Open or Private Sub Workbook_Open() to run at star Paul Moles Excel Programming 0 October 28th 04 03:53 PM
Auto_Open Vs Workbook_open Soniya Excel Programming 2 September 23rd 03 03:56 PM


All times are GMT +1. The time now is 09:53 PM.

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"