AUTO_OPEN (Stupid question)

Mark O'Brien

MrExcel MVP
Joined
Feb 15, 2002
Messages
3,530
Hey,

I've just been sent a macro diseased workbook from a vendor. It was originally created in Excel 5.0/95 and uses the "AUTO_OPEN" doo hicky.

My question is this. Obviously AUTO_OPEN is supported in XL2000 (which is what I've got) in some fashion for backward compatibility.

As an example, say I didn't want to put any code in the worksheets or workbook objects. If I were to use AUTO_OPEN instead of the Workbook Open event, would I have to save the workbook in Excel 95 format. (it appears that AUTO_OPEN can be in any module and will still work. I'm also too busy to mess around with it just now)

Additional question, does anyone use this sort of thing to keep their workbook free of code?

PS. Yes, for a substantial discount on their equipment, I have offered the vendor my expertise to modernise their workbook. :biggrin:
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi Mark,

The Auto_Open will work whether the workbook is saved as version 5.0 or 2000. There are a couple arguments for switching over to Workbook events rather than the Auto_Open:

1. who knows how much longer Auto_Open will continue to be supported since it is an archaic feature. Microsoft is encouraging developers to switch from Auto_Open to the Open event;

2. someone may try to add an Open event macro to the workbook without being aware of the Auto_Open, and the result could be code that conflicts;

3. obviously, using Auto_Open does not keep the workbook free of code, since the standard code module containing the Auto_Open is stored with the workbook as well.

All that said, I should also mention that there are some bugs still remaining in the worksheet/workbook events. If you encounter one of these it can sometimes be eliminated by reverting to the old Excel 5 Auto_Open type event routines. Usually these bugs are fairly obvious so you would know if you had one.
 
Upvote 0
Hi,

I have heard of only one advantage to using the Auto_Open rather than the Workbook_Open event. Naturally it came out of *yet another* small spat between Harlan Grove and an Excel MVP. This time it is Rob Bovey.

The following is the original thread:

http://groups.google.com/groups?hl=...W.12191317@bgtnsc05-news.ops.worldnet.att.net

Here, when there is interaction between Excel and another program/application (a PERL controller in this case), occasionally Excel needs to "tidy up" a bit before opening fully and occasionally the open event happens before that clean up.

Now, I may be misinterpreting what Rob is saying, but the post was from 2002, so Rob definitely is aware of the workbook_open event, and I believe it is a clear decision to go to the auto_open here.

That said, Damon makes excellent points and the benefits seem to outweigh this one drawback by a considerable margin.

Bye,
Jay

EDIT: On second thought, I think that a worksheet_open event will work, with Rob's suggestion to wait a bit before calling a routine, rather than just calling the routine directly.
This message was edited by Jay Petrulis on 2002-05-06 11:00
 
Upvote 0
Thanks guys.

Yeah, I was actually going to ask if XP still supported this feature. Usually I wouldn't expect too much backward compatibility after 3 versions.

Obviously I wouldn't want to use this unless it's absolutely necessary and would only use it in versions that knew that it worked in. (and the question was more for future reference, should I ever need to use it)

I was thinking that it's easier to strip/export standard modules from workbooks than from the worksheet and workbook objects. This would be one advantage I could see.

Anyway, thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top