Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automatically run macro when opening file

Hello,
I would like to run a macro automatically when the Excel file opens.
The macro is written, but what do I do from here?

Thank you,
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatically run macro when opening file

Open the Workbook.
Press "Alt + F11"
Press "Ctrl + R"
There will be a window labeled Project - VBAProject
Inside that window there will be listed any open workbooks.
Look under the workbook you're working with to find "ThisWorkbook" an
double-click it.
Another window will appear with "ThisWorkbook (CODE)" in the titl
bar.
There will be two drop down menus near the top of this window.
Drop both of these down and select "Workbook" from the one on the lef
and "Open" from the one on the right.
The body of the window should read:

Private Sub Workbook_Open()

End Sub

Place the code there.

- Piku

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatically run macro when opening file

Add a SUB procedure titled Auto_Open to your module.
execute your code in that SUB or call your routine as
needed. The next time you open the spreadsheet your code
will automatically run.

Holding down the SHIFT key when opening the spreadsheet
will suppress running the Auto_Open routine for testing.

Sub Auto_Open()

myRoutine

End Sub

Sub myRoutine()

'Do your code here

End Sub

-----Original Message-----
Hello,
I would like to run a macro automatically when the Excel

file opens.
The macro is written, but what do I do from here?

Thank you,
Chris
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Automatically run macro when opening file

Pikus-
Thanks! That was the simplest task ever thanks to your detailed
instruction. Much appreciated.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatically run macro when opening file

name your macro
auto_open
see example below



sub auto_open
msgbox("Hello New User")
end sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Automatically run macro when opening file

Note that this method has been deprecated in favor of using the
Workbook_Open event macro, placed in the ThisWorkbook module:

Private Sub Workbook_Open()
MsgBox "Hello New User" 'no parens needed
End Sub

One significant difference: Event macros will run if the workbook is
opened from code. Automacros require an explicit RunAutoMacro
statement.


In article ,
"Drlegend" wrote:

name your macro
auto_open
see example below



sub auto_open
msgbox("Hello New User")
end sub

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 To Run Automatically For Any Worksheet Upon Opening Of THe F BB[_2_] Excel Discussion (Misc queries) 2 July 22nd 08 10:55 PM
Opening a tab automatically in a file Jaydubs Excel Discussion (Misc queries) 6 June 28th 06 08:49 PM
Run macro automatically on opening of worksheet bnkone Excel Worksheet Functions 1 February 13th 06 09:46 PM
Copy File Automatically on Opening It Dolores Excel Discussion (Misc queries) 4 December 30th 05 07:12 PM
How do I stop a new file from opening automatically? Melissa Excel Discussion (Misc queries) 1 March 1st 05 09:07 PM


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