ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel - open a new workbook with "own" macro (https://www.excelbanter.com/excel-worksheet-functions/42100-excel-open-new-workbook-%22own%22-macro.html)

Danny

Excel - open a new workbook with "own" macro
 
I wrote a simple macro and I'd like that macro to be included in every
workbook that I open.

I tried but failed to locate the template to launch a new workbook.

Please help. Thank you.

Duke Carey

Why would you want it in every workbook and not in your Personal.xls file?
If you put it there, it's available any/everytime you run Excel.

If you really want it in every workbook you create, svae it in BOOK.XLT in
the

C:\Documents and Settings\user_name\Application Data\Microsoft\Excel\XLSTART

directory

"Danny" wrote:

I wrote a simple macro and I'd like that macro to be included in every
workbook that I open.

I tried but failed to locate the template to launch a new workbook.

Please help. Thank you.


Danny

The macro (change the pointer color) is in my personal workbook but it
doesn't run when I open a new workbook. Of course my personal workbook opens
(hidden) when I open a workbook. I tried what you said but it doesn't work
either. Help!

"Duke Carey" wrote:

Why would you want it in every workbook and not in your Personal.xls file?
If you put it there, it's available any/everytime you run Excel.

If you really want it in every workbook you create, svae it in BOOK.XLT in
the

C:\Documents and Settings\user_name\Application Data\Microsoft\Excel\XLSTART

directory

"Danny" wrote:

I wrote a simple macro and I'd like that macro to be included in every
workbook that I open.

I tried but failed to locate the template to launch a new workbook.

Please help. Thank you.


Duke Carey

Bob Phillips posted this just a little bit ago in the Excel General Questions
NG. It applies to setting a print footer, but you can look at the
application object's events and try to find one that would work for you.
There's a NewWorkbook event and several others that might make sense
------------------------------------------------------------------------------------------
You could try this. Add this code to Personal.xls, and it will then
automatically set the footer for any sheet in any workbook.

Private WithEvents app As Application

Private Sub app_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
With Wb.ActiveSheet
.PageSetup.LeftFooter = "&""Arial,Bold""&8" & Wb.FullName
End With
End Sub

Private Sub Workbook_Open()
Set app = Application
End Sub


'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

-------------------------------------------------------------------------------------------
"Danny" wrote:

The macro (change the pointer color) is in my personal workbook but it
doesn't run when I open a new workbook. Of course my personal workbook opens
(hidden) when I open a workbook. I tried what you said but it doesn't work
either. Help!

"Duke Carey" wrote:

Why would you want it in every workbook and not in your Personal.xls file?
If you put it there, it's available any/everytime you run Excel.

If you really want it in every workbook you create, svae it in BOOK.XLT in
the

C:\Documents and Settings\user_name\Application Data\Microsoft\Excel\XLSTART

directory

"Danny" wrote:

I wrote a simple macro and I'd like that macro to be included in every
workbook that I open.

I tried but failed to locate the template to launch a new workbook.

Please help. Thank you.



All times are GMT +1. The time now is 02:51 PM.

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