+ Reply to Thread
Results 1 to 2 of 2

Header and Footer Macro

Hybrid View

  1. #1
    dhuang via OfficeKB.com
    Guest

    Header and Footer Macro

    Hi!

    I created a Macro that inserts the path file, name, and date but I want to
    automate the authors name in their too. I remember someone inserting a
    msgbox that allowed the author to put in his/her name and it would show in
    the footer. As of right now this is what the Macro looks like:

    How do I also insert the authors name?

    Sub Traveler_Chart()
    '
    ' Traveler_Chart Macro
    ' Macro recorded 10/31/2005 by David Huang 6-8395
    '

    '
    With ActiveSheet.PageSetup
    .PrintTitleRows = ""
    .PrintTitleColumns = ""
    End With
    ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = ""
    .RightHeader = "&D"
    .LeftFooter = "" & Chr(10) & "&D&T"
    .CenterFooter = ""
    .RightFooter = "&Z&F"
    .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)
    .PrintHeadings = False
    .PrintGridlines = False
    .PrintComments = xlPrintNoComments
    .PrintQuality = 600
    .CenterHorizontally = False
    .CenterVertically = False
    .Orientation = xlPortrait
    .Draft = False
    .PaperSize = xlPaperLetter
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = 100
    .PrintErrors = xlPrintErrorsDisplayed
    End With
    End Sub

  2. #2
    Dave O
    Guest

    Re: Header and Footer Macro

    You'd need to add a few lines of code at the top, something like this:

    Dim UserName As String

    Do Until UserName <> ""
    UserName = InputBox("Please enter your name: ", "INPUT REQUIRED")
    Loop

    and then change one of the footer lines (.LeftFooter, .CenterFooter,
    ..RightFooter) like this:
    ..RightFooter = "&Z&F" & " " & UserName


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1