Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2009

Tip: Looking for answers? Try searching our database.

Excel 2000 Header Date Format..

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JD - 29 Jan 2009 15:37 GMT
I'm moving from MS Works to MS Office 2000.

In Excel, the date in the Header is all numbers, for example, today's
date is 29-01-09 but I want it to show 29 January 2009.

I can't figure out what to change to get the proper date format. I do
want the format as dd-mm-yyyy but I want the month to be January not 01.

I'm using Windows XP home edition SP3.

Signature

 JD..

Gord Dibben - 29 Jan 2009 16:03 GMT
Excel takes the header date from your Windows short date settings.

You cannot change that setting to the format you want to see.

You can run a macro to set the date as you wish.

Sub header_date()
ActiveSheet.PageSetup.RightHeader = Format(Date, "dd mmmm yyyy")
End Sub

Gord Dibben  MS Excel MVP

>I'm moving from MS Works to MS Office 2000.
>
[quoted text clipped - 5 lines]
>
>I'm using Windows XP home edition SP3.
JD - 29 Jan 2009 16:23 GMT
I set my Windows short date settings this way:

Control Panel, Regional and Language Options, Regional Options tab,
Short date: 29-Jan-09

So even though it's set that way, Excel is going to replace the Jan with 01?

How do I run a macro?

> Excel takes the header date from your Windows short date settings.
>
[quoted text clipped - 17 lines]
>>
>> I'm using Windows XP home edition SP3.

Signature

 JD..

JD - 29 Jan 2009 16:46 GMT
I used Help and I got it to work. Thanks!

Do I just run the Macro once or do I need to run it for each new Excel
spreadsheet?

MS Works didn't work like this. ;-)

> Excel takes the header date from your Windows short date settings.
>
[quoted text clipped - 17 lines]
>>
>> I'm using Windows XP home edition SP3.

Signature

 JD..

Dave Peterson - 29 Jan 2009 18:06 GMT
You'll need to do it for each sheet in every workbook that you want.

And you'll want to do it each day, too.  Otherwise, you'll be left with the old
date when you print.

> I used Help and I got it to work. Thanks!
>
[quoted text clipped - 27 lines]
> --
>   JD..

Signature

Dave Peterson

JD - 29 Jan 2009 20:27 GMT
Will I have to delete the old date or will it over-write it?

Is there any other way to do what I want without using a macro?

The spreadsheet in MS Works doesn't behave this way. It gives me options
on what date format I want to insert into the header or footer.

> You'll need to do it for each sheet in every workbook that you want.
>
[quoted text clipped - 31 lines]
>> --
>>   JD..

Signature

 JD..

Dave Peterson - 29 Jan 2009 21:02 GMT
If you use the code that Gord provided, then it that header section willl be
overwritten each time you run the macro.

You can always do it manually.

Excel isn't Works.

> Will I have to delete the old date or will it over-write it?
>
[quoted text clipped - 41 lines]
> --
>   JD..

Signature

Dave Peterson

JD - 29 Jan 2009 22:26 GMT
How do I add to the macro to also include the file name with three
spaces between the file name and the date?

Also, when I start this .xls file I get a warning about running macros
so can I somehow identify myself as the author of this macro and allow
it to run without the warning? If I can, how do I do that?

Or is there a better way to enter the file name and long date without
doing it manually?

> If you use the code that Gord provided, then it that header section willl be
> overwritten each time you run the macro.
[quoted text clipped - 47 lines]
>> --
>>   JD..

Signature

 JD..

Dave Peterson - 29 Jan 2009 23:27 GMT
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..

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.