You could digitally sign your workbook. I've never done this, but I think
excel's help describes the process.
Personally, I wouldn't want this in each workbook I use. It's redundant and
it'll make updates a real pain to catch up.
I'd use an addin that does the work. And I'd store this addin in my XLStart
folder. I'd name the workbook/addin "JDsUtils.xla".
If you want to try...
Start a new workbook
Put this in a general module:
Option Explicit
Public Const ToolBarName As String = "JD's Utilities"
Private Sub Auto_Open()
Call CreateMenubar
End Sub
Private Sub Auto_Close()
Call RemoveMenubar
End Sub
Private Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(ToolBarName).Delete
On Error GoTo 0
End Sub
Private Sub CreateMenubar()
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNames As Variant
Dim TipText As Variant
Call RemoveMenubar
MacNames = Array("FixOneSheet", _
"FixAllSheets")
CapNames = Array("Add Headers to this sheet", _
"Add Headers to All Sheets")
TipText = Array("Run this for just the activesheet", _
"Run this for all the sheets")
With Application.CommandBars.Add
.Name = ToolBarName
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
For iCtr = LBound(MacNames) To UBound(MacNames)
With .Controls.Add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
.Caption = CapNames(iCtr)
.Style = msoButtonCaption
.TooltipText = TipText(iCtr)
End With
Next iCtr
End With
End Sub
Private Sub FixOneSheet()
Call DoTheWork(ActiveSheet)
End Sub
Private Sub FixAllSheets()
Dim sh As Object
For Each sh In ActiveWorkbook.Sheets
Call DoTheWork(sh)
Next sh
End Sub
Private Sub DoTheWork(sh As Object)
'to include the path, you could use
'sh.parent.fullname
sh.PageSetup.RightHeader _
= sh.Parent.Name & " " & Format(Date, "dd mmmm yyyy")
End Sub
Then back to excel.
File|SaveAs
choose Addin
and store it in your XLStart folder.
Close excel and restart it.
Then open or create a new workbook and test it.
ps. If you decide you want to fiddle with the header, record a macro when you
change it manually. You may be able to pick out the pieces you need (like
font/font size) and included it in this code.
> How do I add to the macro to also include the file name with three
> spaces between the file name and the date?
[quoted text clipped - 60 lines]
> --
> JD..

Signature
Dave Peterson
JD - 30 Jan 2009 00:11 GMT
Sorry Dave but you lost me here. I'll have to read up on macros because
it's like I'm reading a foreign language. ;-)
Do you have a simple macro to add the filename and date separated by
three spaces?
I find this odd that a simple program like MS Works spreadsheet makes
adding a long date so easy and Excel makes it so hard.
Thanks for trying to help!
> You could digitally sign your workbook. I've never done this, but I think
> excel's help describes the process.
[quoted text clipped - 154 lines]
>> --
>> JD..

Signature
JD..
Gord Dibben - 30 Jan 2009 00:26 GMT
Get rid of first macro.
Place this code in Thisworkbook module.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = ActiveWorkbook.FullName _
& " " & ActiveSheet.Name _
& " " & Format(Date, "dd mmmm yyyy")
End Sub
Will run when you print any sheet.
And quit comparing Excel to Works.......that's three times now<g>
Gord
>Sorry Dave but you lost me here. I'll have to read up on macros because
>it's like I'm reading a foreign language. ;-)
[quoted text clipped - 165 lines]
>>> --
>>> JD..
JD - 30 Jan 2009 02:10 GMT
I changed your macro to this:
Sub header_date()
ActiveSheet.PageSetup.CenterHeader = ActiveWorkbook.Name _
& " " & Format(Date, "dd mmmm yyyy")
End Sub
And that does what I want. FileName Long Date (header centered)
I'm sorry that I keep referring to the "other" program but I didn't need
no macro to insert the long date. ;-)
I guess I can live with the macro warning unless you have something to
add to the above macro so I can allow it to run without the warning and
not have to mess with the Thisworkbook module. Maybe down the road I'll
understand this better.
Thanks for your help.
> Get rid of first macro.
>
[quoted text clipped - 182 lines]
>>>> JD..
>

Signature
JD..