I
itsme
I have a macro in one of my sheets of a 9 sheet file (run by ctrl z). Is there anyway to have it run automatically when I first open the file. If so, how?
Thanks
Thanks
Frank Kabel said:Hi
you could also rename your macro to Autpen()
Frank Kabel said:Hi
sorry. In the first suggestion just use
Public sub workbook_open()
your_macro_name
end sub
Frank Kabel said:Hi
as said by Anson: In your workbook module ('ThisWorkbook') in the VBA
editor
by ctrl z). Is there anyway to have it run automatically-----Original Message-----
I have a macro in one of my sheets of a 9 sheet file (run
Thanks
.
David McRitchie said:Seems to me that everything has been stated a few times.
Project Library is another name for the workbooks, so if your
workbook is named myworkbook.xls bring up the VBE
then Ctrl+R (View, Project Explorer) then for your t project
name and expand everything, you will see ThisWorkBook after
a directory of sheetnames.
A shortcut for getting to ThisWorkBook for installing
Workbook Events is:
right-click on the Excel logo to left of file menu, view code
BTW, when you find it what part was the key that wasn't
stated before.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
Chip Pearson said:In the VBA Editor, press CTRL+R to open the Project Explorer
window. In this window, you should see a tree-view with a
"folder" icon for each open workbook. Click the Plus sign to
expand your workbook. There, you should see a "folder" called
"Microsoft Excel Objects". Click the Plus sign to expand that,
and you'll see a "file" icon called ThisWorkbook. Double-click
that to open the ThisWorkbook code module.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
itsme said:Thanks everone, it finally works!!!!
Great
If I want to have more then one macro run when the file opens do I just add more at the same spot?
Example:
Public sub workbook_open()
Macro18
end sub
Public sub workbook_open()
Macro41
end sub
David McRitchie said:Seems to me that everything has been stated a few times.
Project Library is another name for the workbooks, so if your
workbook is named myworkbook.xls bring up the VBE
then Ctrl+R (View, Project Explorer) then for your t project
name and expand everything, you will see ThisWorkBook after
a directory of sheetnames.
A shortcut for getting to ThisWorkBook for installing
Workbook Events is:
right-click on the Excel logo to left of file menu, view code
BTW, when you find it what part was the key that wasn't
stated before.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
Chip Pearson said:In the VBA Editor, press CTRL+R to open the Project Explorer
window. In this window, you should see a tree-view with a
"folder" icon for each open workbook. Click the Plus sign to
expand your workbook. There, you should see a "folder" called
"Microsoft Excel Objects". Click the Plus sign to expand that,
and you'll see a "file" icon called ThisWorkbook. Double-click
that to open the ThisWorkbook code module.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
I have nothing that says 'ThisWorkbook'?
What do you mean by the left explorer window?
Thanks for all your help!
:
Hi
try the following to get to your workbook module (this module
stores
the workbook event code procedures):
- open your Excel file
- open the VBA editor (hit ALT+F11)
- in the left explorer window should be an item named
'ThisWorkbook'
- double click on this entry
- paste the code in the appearing editor window
To learn more about event procedures take a look at:
http://www.cpearson.com/excel/events.htm
--
Regards
Frank Kabel
Frankfurt, Germany
itsme wrote:
Im lost when you guys say workbook module?
:
Hi
as said by Anson: In your workbook module ('ThisWorkbook')
in the
VBA
editor
--
Regards
Frank Kabel
Frankfurt, Germany
itsme wrote:
Where and how am I putting this?
:
Hi
sorry. In the first suggestion just use
Public sub workbook_open()
your_macro_name
end sub
--
Regards
Frank Kabel
Frankfurt, Germany
itsme wrote:
OK Frank you confused me now?
:
Hi
you could also rename your macro to Autpen()
--
Regards
Frank Kabel
Frankfurt, Germany
itsme wrote:
Instead of rewritng the whole code there, cannt I
somehow just
write to run this macro (ctrl z)? If yes, what
exactly do I
write? Thanks
:
Put the codes in "ThisWorkbook" module in VB Editor
as shown
below:
Private Sub Workbook_Open()
'-------------Code Contents----------------
End Sub
:
I have a macro in one of my sheets of a 9 sheet
file (run by
ctrl z). Is there anyway to have it run
automatically when I
first open the file. If so, how?
Thanks