Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto_Run Macro

Helo,
Can any body tell me how can a macro be executed automatically when
ever i open a workbook.
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto_Run Macro

Hi,

Put whatever code you wish to run inside a Sub called
Auto_Open and it will be run whenever the workbook is
opened.

eg.

Sub Auto_Open

MsgBox("This message will appear as soon as this
workbook has opened!!")

End Sub
-----Original Message-----
Helo,
Can any body tell me how can a macro be executed

automatically when
ever i open a workbook.
Thanks in advance
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Auto_Run Macro

The Workbook_Open() method should do the trick.
-----Original Message-----
Helo,
Can any body tell me how can a macro be executed

automatically when
ever i open a workbook.
Thanks in advance
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto_Run Macro

Just some added info:
Note that Workbook_Open is a workbook level event and should be placed in
the ThisWorkbook module of the workbook rather than a sheet module or a
general module.

Go into the VBE (alt+F11) and look in the project explorer (Ctrl+R if it
isn't visible). Find your workbook in the "tree" and look for the
ThisWorkbook entry under that. Double click on ThisWorkbook and the
thisworkbook module will open. In the left dropdown at the top select
Workbook and in the right dropdown, select open. It will put in the
skeleton declaration for the Open Event

Private Sub Workbook_Open()

End Sub

put your code in that declaration or call it from that declaration.

--
Regards,
Tom Ogilvy

"Lieven Roelens" wrote in message
...
The Workbook_Open() method should do the trick.
-----Original Message-----
Helo,
Can any body tell me how can a macro be executed

automatically when
ever i open a workbook.
Thanks in advance
.



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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 04:22 AM.

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"