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

How would I have a macro run automatically upon opening a file.
Mike



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Auto Run Macro Upon Entry

Put it in a general module and name it
sub auto_open()

or put it behind the ThisWorkbook module and name it:
sub workbook_open()



Michael Smith wrote:

How would I have a macro run automatically upon opening a file.
Mike

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Auto Run Macro Upon Entry

Mike, use the workbook open event, like this

Private Sub Workbook_Open()
'put your macro here
End Sub

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is to the left of the "File" menu this will open
the VBA editor, in the left hand window double click on thisworkbook, under
your workbook name, and paste the code in the window that opens on the right
hand side, press Alt and Q to close this window and go back to your
workbook, now this will run every time you open the workbook. If you are
using excel 2000 or newer you may have to change the macro security
settings to get the macro to run. To change the security settings go to
tools, macro, security, security level and set it to medium

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"Michael Smith" wrote in message
...
How would I have a macro run automatically upon opening a file.
Mike



*** Sent via Developersdex http://www.developersdex.com ***



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 entry on cell entry Tony Excel Discussion (Misc queries) 1 March 8th 10 07:21 PM
Macro for pop up message box for auto-filter entry Roady Excel Discussion (Misc queries) 1 January 20th 09 06:26 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
How do I set up entry box to auto-alphabatize each entry in list? jhakers Excel Discussion (Misc queries) 0 February 14th 08 08:01 PM
Auto entry of "=" before dates lg Excel Worksheet Functions 2 January 28th 05 01:13 AM


All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"