Solved

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

Posted on 2014-01-15
6
281 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

749 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