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

How do i get a macro to run when an excel file is opened without having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Start macro on open

Add the macro to your workbook_open event.
It will look like this:
Private Sub Workbook_Open()
macroname
End Sub

"Stu" wrote in message
...
How do i get a macro to run when an excel file is opened without having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Start macro on open

Make sure the macro starts with

(this Auto_Open macro can be placed in any VBA module in
your project)

Sub Auto_Open()

' call your macro here or place your code here

End Sub
-----Original Message-----
How do i get a macro to run when an excel file is opened

without having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Start macro on open

What if i want it to open on just one sheet and start running and not
the whole workbook?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Start macro on open

Use the Worksheet_Activate event.

--

HTH

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

"Stu" wrote in message
...
What if i want it to open on just one sheet and start running and not
the whole workbook?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Start macro on open

Stu,

Either name the macro Auto_Open and put it in a normal code module (old way)
or put it in Worksheet_Open event code in ThisWorkbook code module (new
way).

--

HTH

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

"Stu" wrote in message
...
How do i get a macro to run when an excel file is opened without having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Start macro on open

Even if the auto_open is the old way I think it may have the edge.

If you have run someone else's bad code on your machine then they may
have left your application as application.enableevents = false, if
this is the case then when you try to run the workbooks_open event it
won't fire.

The EnableEvents property doesn't seem to affect an Auto_open routine.

J

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

Either name the macro Auto_Open and put it in a normal code module (old way)
or put it in Worksheet_Open event code in ThisWorkbook code module (new
way).

--

HTH

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

"Stu" wrote in message
...
How do i get a macro to run when an excel file is opened without having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Start macro on open

That's not an edge for auto_open, it's just accommodating the possibility of
poor coding.

Bob

"jason" wrote in message
om...
Even if the auto_open is the old way I think it may have the edge.

If you have run someone else's bad code on your machine then they may
have left your application as application.enableevents = false, if
this is the case then when you try to run the workbooks_open event it
won't fire.

The EnableEvents property doesn't seem to affect an Auto_open routine.

J

"Bob Phillips" wrote in message

...
Stu,

Either name the macro Auto_Open and put it in a normal code module (old

way)
or put it in Worksheet_Open event code in ThisWorkbook code module (new
way).

--

HTH

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

"Stu" wrote in message
...
How do i get a macro to run when an excel file is opened without

having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Start macro on open

A good time to learn to use the archives and/or help. Look for auto_open or
workbook_open

"Stu" wrote in message
...
How do i get a macro to run when an excel file is opened without having
to click run macro?

Thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.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
MS Word and MS Excel won't open from the START menu. OHL101 Excel Discussion (Misc queries) 2 August 24th 09 08:52 PM
Excel trys to open files on start up pkerr Excel Discussion (Misc queries) 6 November 4th 06 08:52 PM
How do I start a new application when I open a file? jkwillis99 Excel Discussion (Misc queries) 1 January 13th 06 01:16 PM
When i open excel on the start dialogue, it does not open. lemon8 Setting up and Configuration of Excel 1 December 14th 05 05:37 AM
personal.xls won't open when I start Excel Tired of Bugs Excel Discussion (Misc queries) 4 October 9th 05 10:57 PM


All times are GMT +1. The time now is 12:43 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"