ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto opening macro when loading a workbook (https://www.excelbanter.com/excel-programming/297654-auto-opening-macro-when-loading-workbook.html)

Mike Boardman

Auto opening macro when loading a workbook
 
I really ought to know this but I have completely forgotten how to do it.

I'm sure it's something to do with switches or namng the macro, but none of
the methods I have tried work.

Can anyone help me out please? TIA



Simon Lloyd[_429_]

Auto opening macro when loading a workbook
 
Hiya Mike,

I'm pretty new this but i know this one, go to tools then macros the
macro you will see that the box is blank now start typing in the blan
box type this :- Auto_open then click create, you must use the unde
score...there are only 2 auto macros and f course the other i
Auto_close. When you hae created your macro just paste any recorde
code that u want to run on open in here!

hope this helps.

Simo

--
Message posted from http://www.ExcelForum.com


Anders S[_2_]

Auto opening macro when loading a workbook
 
Mike,

In the code for ThisWorkbook:

Private Sub Workbook_Open()
MsgBox "Do it"
End Sub

Excel 2002

HTH
Anders Silven

"Mike Boardman" skrev i meddelandet
...
I really ought to know this but I have completely forgotten how to do it.

I'm sure it's something to do with switches or namng the macro, but none of
the methods I have tried work.

Can anyone help me out please? TIA




Bob Phillips[_6_]

Auto opening macro when loading a workbook
 
Mike,

Naming the macro Auto_Open is the old (tried and trusted) way, and goes in
a standard code module, but when events made their appearance we got
Workbook_Open, which goes in the ThisWorkbook module.

A thing to note about Auto_Open is that it does not get run if a workbook is
opened from VBA, so you would need to do it explicitly with "RunAutoMacros
xlAutoOpen"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike Boardman" wrote in message
...
I really ought to know this but I have completely forgotten how to do it.

I'm sure it's something to do with switches or namng the macro, but none

of
the methods I have tried work.

Can anyone help me out please? TIA





Mike Boardman

Auto opening macro when loading a workbook
 
Thanks a lot folks - knew it was something like that!

Mike


"Bob Phillips" wrote in message
...
Mike,

Naming the macro Auto_Open is the old (tried and trusted) way, and goes

in
a standard code module, but when events made their appearance we got
Workbook_Open, which goes in the ThisWorkbook module.

A thing to note about Auto_Open is that it does not get run if a workbook

is
opened from VBA, so you would need to do it explicitly with "RunAutoMacros
xlAutoOpen"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike Boardman" wrote in message
...
I really ought to know this but I have completely forgotten how to do

it.

I'm sure it's something to do with switches or namng the macro, but none

of
the methods I have tried work.

Can anyone help me out please? TIA








All times are GMT +1. The time now is 09:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com