Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Auto Run an Excel macro After opening a Workbook

Posted on 1998-09-17
3
904 Views
Last Modified: 2012-06-27
Need to run a macro automatically after opening an Excel 97 Workbook.

Any suggestion?

Thanks
0
Comment
Question by:vtang
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
shalbe earned 100 total points
ID: 1613688
vtang,

Name the macro Auto_Open.

This will automatically run the macro when you open the workbook.

Steve
0
 
LVL 3

Expert Comment

by:shalbe
ID: 1613689
vtang,

In Excel97 another way to do it is to go to the Visual Basic editor.

Double click on ThisWorkbook on the left side.

In the top left hand dropdown, where it says (General), select Workbook.

The event listed in the right hand drop down should default to Open and a macro called Workbook_Open will be created.

This subroutine will also autorun when the workbook is opened. Workbook_Open is the new method in Excel97. Auto_Open is from earlier versions but still works fine.

Steve
0
 

Expert Comment

by:rauchs
ID: 1613690
Also something to be aware of that there is a registered Microsioft Bug with running more than one Auto_Open Macro from code. ie If you are opening sevberal books and are exectuing their Auto_Open macros, only the first one will be executed.

Regs

Steve
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question