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

Hi Sha-auto

here's a reply i sent to a friend the other day with the same question:
to run a macro automatically when a workbook opens use the WORKBOOK_OPEN
procedure - in the "THISWORKBOOK" module and not stored in a normal macro
sheet - to get there ..
1) right mouse click on a sheet tab in your excel workbook and choose view
code
2) in the VBE window you should see your workbook's name in bold (& in
brackets) on the top left, if not, choose view / project explorer -
underneath the workbook's name you should see Sheet1, Sheet2, Sheet3 etc and
ThisWorkbook.
3) double click on ThisWorkbook
4) on the right hand side of the screen choose from the left hand drop down
"Workbook" and from the right hand one "Open" if it doesn't appear
automatically
5) now put your code in here between the Private Sub Workbook_Open()
and the
End Sub
6) close the VBE window using the X top right hand side.

oh, and you also need to set your security (tools / macro / security)
settings to medium or low (not recommended) for the macro to work when you
open the workbook


Hope this helps
Cheers
JulieD


"Sha-auto" wrote in message
...

Hi,
I need to run a Macro automatically, when I open a file - is this
possible ? If so could you let me know how, or steer me in the right
direction at least. I couldn't find it in Excel help or on this forum
as a question posted previously.
I want to open a file from a desktop shortcut and then run the Macro
automatically...
Many thanks to all you Excel wizards out there, I found some very
interesting ideas/solutions when hunting for this answer.


--
Sha-auto
------------------------------------------------------------------------
Sha-auto's Profile:
http://www.excelforum.com/member.php...o&userid=15704
View this thread: http://www.excelforum.com/showthread...hreadid=272332



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
Autorun macro Josh Excel Discussion (Misc queries) 2 August 16th 09 02:19 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM
autorun code when opening sheet (not workbook) Steve Mutambo Excel Programming 3 April 2nd 04 04:46 PM
Autorun macro on opening spreadsheet simonjackson79 Excel Programming 3 November 5th 03 02:22 PM
autorun macro hke[_3_] Excel Programming 6 October 16th 03 01:18 PM


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