Solved

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

Posted on 2014-01-15
6
235 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

743 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

13 Experts available now in Live!

Get 1:1 Help Now