ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run a macro when file is open (https://www.excelbanter.com/excel-programming/326396-run-macro-when-file-open.html)

nabil

run a macro when file is open
 
any one out there knows how to run a macro automatically in a workbook when
the workbook is open. I do not want the user to go to tools,macro,choose a
name and run the macro, what I am looking for is a way to run the macro
automatically. any one knows of a way to do this???? your comment is
appreciated

Jim Thomlinson[_3_]

run a macro when file is open
 
On your spreadsheet in the upper left corner is the excel logo. Right click
it and select view code. This will open up the VB screen and you will be in
the ThisWorkbook object. Just above the Code window you will see a drop down
with the word General in it. Change that to Workbook. At this point it should
create some code in the Code window that looks like

Private Sub Workbook_Open()

End Sub

This procedure will fire when the workbook is opened so just call your
procedure from here like this

Private Sub Workbook_Open()
Call MyProcedure
End Sub

HTH

"nabil" wrote:

any one out there knows how to run a macro automatically in a workbook when
the workbook is open. I do not want the user to go to tools,macro,choose a
name and run the macro, what I am looking for is a way to run the macro
automatically. any one knows of a way to do this???? your comment is
appreciated


Saladin

run a macro when file is open
 
can't you just fire your proc from Auto_Open?
"nabil" wrote in message
...
any one out there knows how to run a macro automatically in a workbook
when
the workbook is open. I do not want the user to go to tools,macro,choose a
name and run the macro, what I am looking for is a way to run the macro
automatically. any one knows of a way to do this???? your comment is
appreciated





All times are GMT +1. The time now is 08:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com