Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Workbook Open Vs Auto_Open

Hi all,

What diffetrecnce it makes a code under Workbook Open or
under Auto_Open

TIA

Soniya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Workbook Open Vs Auto_Open

"Soniya" wrote in message
...
What diffetrecnce it makes a code under Workbook Open or
under Auto_Open


From a coding standpoint it really doesn't make any difference at all.
I'm sure you could come up with some obscure situations in which the
sequence of event firings matter (of all the procedures that run
automatically when a workbook opens, Auto_Open always runs last), but I
haven't seen any that could easily be worked around.

I tend to use Auto_Open simply to avoid placing any code in the code
module behind the ThisWorkbook object. Any code in this area has the
possibility of becoming corrupt. If corruption does occur in this area,
there's no way to fix it short of rebuilding the whole workbook. This
obviously doesn't apply if you're using a WithEvents class module to trap
the Workbook_Open event from some other workbook, though.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Workbook Open Vs Auto_Open

Just adding to Rob's reply...The Auto_Open macro does not execute if the
workbook is opened via Automation; that is, if it is opened with VBA code.
In this case, the calling code would have to call "Workbook.RunAutoMacros
xlAutoOpen" to execute the Auto_Open macro. The Workbook_Open event is
called regardless of how the workbook is opened.


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



"Rob Bovey" wrote in message
...
"Soniya" wrote in message
...
What diffetrecnce it makes a code under Workbook Open or
under Auto_Open


From a coding standpoint it really doesn't make any difference at all.
I'm sure you could come up with some obscure situations in which the
sequence of event firings matter (of all the procedures that run
automatically when a workbook opens, Auto_Open always runs last), but I
haven't seen any that could easily be worked around.

I tend to use Auto_Open simply to avoid placing any code in the code
module behind the ThisWorkbook object. Any code in this area has the
possibility of becoming corrupt. If corruption does occur in this area,
there's no way to fix it short of rebuilding the whole workbook. This
obviously doesn't apply if you're using a WithEvents class module to trap
the Workbook_Open event from some other workbook, though.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *




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
How to: Open closed workbook/Search data tables/Return data to open workbook Hugh Adams Excel Discussion (Misc queries) 0 August 18th 10 02:04 PM
Opening Excel, Book1 opens, remains open with other workbook open DanieB Excel Discussion (Misc queries) 0 September 3rd 09 08:23 AM
how do i open a data workbook when i open a timesheet workbook [email protected] uk Excel Discussion (Misc queries) 2 January 4th 09 04:50 PM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
Search open sheets in workbook and insert into open sheet punx77 Excel Discussion (Misc queries) 0 March 6th 06 05:07 PM


All times are GMT +1. The time now is 11:20 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"