VBA/Excel/Access/Word/Excel/Worksheet Page Header Footer — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:47, 26 мая 2010

Set center footer to your string text

 
Sub FilePathInFooter()
  Dim i As Integer
  
  For i = 1 To Worksheets.Count Step 1
    Worksheets(i).PageSetup.CenterFooter = "your center footer"
  Next i
End Sub



Set the center footer to file path

 
Sub FilePathInFooter()
  Dim i As Integer, FilePath As String
  
  FilePath = ActiveWorkbook.FullName
  For i = 1 To Worksheets.Count Step 1
    Worksheets(i).PageSetup.CenterFooter = FilePath
  Next i
End Sub



To print header, control the font and to pull second line of header (the date) from worksheet

 
Sub Printr()
    ActiveSheet.PageSetup.CenterHeader = "&""Arial,Bold Italic""&14My Report" & Chr(13) _
        & Sheets(1).Range("A1")
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub