start Macro when file is open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to automatically start a Macro when the file is open.
Would anyone help?

Thanks in advance.

jj
 
First Access the Visual Basic Editor by selecting Tools then Macros
then Visual Basic Editor on your Excel Menu.

Go Into the THISWORKBOOK module of the worksheet.
you will see two dropdown bars.
click the left dropdown and select workbook
click the right dropdown and select Open
Then put the name of the macro you'd like to run.
It will run whenever the workbook is opened.
 
Hi James,

Create a new modules in the VBA Editor
Start the code for the module with:
Sub Auto_Open()

Then write your code,

Finish with
End Sub

And everything you have written will be executed whenever that workbook is
opened.

Alternatively,
If you want to record your Macro then go to the Record New Macro dialog as
usual, and when you are asked to name your macro call it Auto_Open and it
will then execute when the workbook is opened.

Neil
www.nwarwick.co.uk
 
=?Utf-8?B?amFtZXM=?= said:
I would like to automatically start a Macro when the file is open.
Would anyone help?

Thanks in advance.

jj

Hi

I believe the procedure you want is called Auto_Open()
It needs to go in a module like this:
Sub Auto_Open()
msgbox"Hello from Auto Open"
End Sub

Hope this helps

Martin French
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top