Solved

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

Posted on 2014-01-15
6
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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 create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

734 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