Solved

Excel 2003- creating a footer that will be in place when a new document opens.

Posted on 2014-01-15
6
249 Views
Last Modified: 2014-01-16
Hello folks- I'm trying to setup a company wide, permanent footer for Excel. I've created a macro that I can activate with a custom toolbar, which works, but this is something I've been asked to enforce, so I need to make sure it starts with this footer in place.

This is what I have so far-

Sub Set_All_Sheets()
Dim wkbktodo As Workbook
Dim ws As Worksheet
    Set wkbktodo = ActiveWorkbook
    For Each ws In wkbktodo.Worksheets
        With ws.PageSetup
       .LeftFooter = "Andrew Young"
        .CenterFooter = "&F"
        .RightFooter = "&D"
        End With
    Next ws
End Sub

As I say, it works fine, I'm just not sure how to implement it as something that starts when Excel opens. I've tried saving it as part of the personal.xls, but it doesn't seem to be creating a file in the XLSTART folder.

And I also need to add the path to the center footer- does anyone know the reference for that?

Thanks.
0
Comment
Question by:AndyWhy
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 39782462
Hi AndyWhy,

You should be able to create a book.xlt (or book.xltx for newer version) and save it to the xlstart folder, so that any book that is created uses that as a template. You get the .xlt by changing the save-as format to template.

Create a new book, change the footer to how you want it and any other formatting settings you want defaulted, and save it as book.xlt in your XLSTART folder. Next time excel is opened, it uses that as a template for how new workbooks are formatted, including your footer.

Similarly, create a workbook with one sheet and call it sheet.xlt to format any sheets people add to their books.

Matt
0
 

Author Comment

by:AndyWhy
ID: 39782642
Thanks Matt. Looks like I was making this a lot more complex than I had to! Would you know the reference for file path, if I was to add it to the code above? As in, if &D brings back today's date what brings back the file path?

Thanks again!
0
 
LVL 35

Expert Comment

by:mvidas
ID: 39782665
I think you can use &[Path] for the path itself, and &[File] for the active filename

If you're looking to create a macro that creates the template (a good idea), you can use Application.StartupPath to reference the xlstart folder (does not include the last \ symbol), like           Application.StartupPath & "\book.xlt"
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:AndyWhy
ID: 39782721
I had problems using &[Path] actually. If, for example, I modified the above code like this-

.CenterFooter = "&[Path]"

it returns 'Path]' when I look at the footer itself.

Thanks for the other advice though, I think I'll probably end up creating a macro.
0
 
LVL 35

Expert Comment

by:mvidas
ID: 39782772
Interesting.. never noticed that before as I've never set that via macro before.

Use &Z instead; when I recorded a macro setting the footer to &[Path] it recorded as &Z. Testing confirmed it works.
0
 

Author Comment

by:AndyWhy
ID: 39785097
Ok, I think I've got it sorted now. Thanks for all your help Matt!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now