Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-01-15
6
Medium Priority
?
302 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

886 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