Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a excel custom format in the footer 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am trying to set a custom footer in excel 2003. I have created a module with the formatting information in it but all I get is the variable in the footer. Any help would be appreciated.

In the footer I have [dtmDate] in the left section

Code:
Public Sub SetFooter()
' put customer name, date and Order# in footer
' [URL unfurl="true"]www.contextures.com[/URL]
Dim wb As Workbook
Dim wsOrder As Worksheet
Dim dtmDate As Date

Set wb = ThisWorkbook
Set wsOrder = wb.Sheets("Orders")

dtmDate = wsOrder.Range("OrderDate").Value

    With wsOrder.PageSetup
        .LeftFooter = _
        Format(dtmDate, "dddd, mmmm dd,yyyy")
      
    End With

End Sub
 

hi,
In the footer I have [dtmDate] in the left section
WHY? Excel knows NOTHING about your date varaiable, dtmDate!

Just run the procedure!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
BTW, no sense in assigning objects & variables when none of them are ever used again in this procedure
Code:
Public Sub SetFooter()
' put customer name, date and Order# in footer
' [URL unfurl="true"]www.contextures.com[/URL]

    With ThisWorkbook.Sheets("Orders")
    
        .PageSetup.LeftFooter = Format(.Range("OrderDate").Value, "dddd, mmmm dd,yyyy")
    
    End With

End Sub

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top