Re: Custom Header Macro
- From: Gord Dibben <gorddibbATshawDOTca>
- Date: Wed, 10 Jan 2007 15:16:19 -0800
Le
Sub DoFullPath()
Active***.PageSetup.CenterHeader = ActiveWorkbook.Name & _
vbLf & Active***.Name
End Sub
Gord Dibben MS Excel MVP
On Wed, 10 Jan 2007 11:01:00 -0800, Le Jurassien <christkim@xxxxxxx> wrote:
Hello,
I am trying to set up custom header macro that will eliminate this extra
step that I have to do on each *** within my reports. I would like to have
the file name then just below the file name, the *** name. I am still
having trouble with specific code that I need to formulate. Can someone help?
Public Sub Add_Sheets()
For i = 13 To 1 Step -1
Worksheets.Add.Name = "Newsheet" & i
Next
End Sub
Public Sub PageSet()
Dim ws As Work***
For Each ws In ActiveWorkbook.Sheets
With ws.PageSetup
.Orientation = xlLandscape
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PaperSize = xlPaperLegal
.FirstPageNumber = xlAutomatic
.CenterHeader = " "
.PrintErrors = xlPrintErrorsDisplayed
End With
Next ws
End Sub
Private Sub Workbook_Open()
Dim ws As Work***
For Each ws In ActiveWorkbook.Sheets
With ws.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.FirstPageNumber = xlAutomatic
.CenterHeader = " "
.PrintErrors = xlPrintErrorsDisplayed
End With
Next ws
End Sub
Sub DoFullPath()
Active***.PageSetup.CenterHeader = _
ActiveWorkbook.Name
End Sub
Thanks,
.
- References:
- Custom Header Macro
- From: Le Jurassien
- Custom Header Macro
- Prev by Date: Re: Linking to Workbooks with Constantly Changing Names
- Next by Date: Re: Autosave to a memory stick
- Previous by thread: Custom Header Macro
- Next by thread: Re: =INDEX(C3:N22,MATCH(G26,B3:B22),MATCH(H26,C2:N2))
- Index(es):