Consulting

Results 1 to 2 of 2

Thread: Macros for Footer

  1. #1

    Macros for Footer

    I had built a macros for MS Excel which will ask the option that needs to be inserted in the footer. I'm trying to build the same for MS Word and SM Powerpoint, but unfortunately I was unsuccessful on several occasions. Please help me in developing the same Macros MS Word and SM Powerpoint.

    Sub FooterSAS()
    Select Case InputBox("Enter 1=Public, 2=Internal Use 3=Confidential 4=Secret")
    Case Is = 1: x = "The classification of this document is: Public"
    Case Is = 2: x = "The classification of this document is: Only for Internal Use"
    Case Is = 3: x = "The classification of this document is: Confidential"
    Case Is = 4: x = "The classification of this document is: Secret"
    Case Else
    End Select
    For Each wk In Application.Workbooks
    For Each sh In wk.Worksheets
    'wk.Sheets(i).Select
    sh.PageSetup.CenterFooter = x
    Next
    Next
    MsgBox strResponse & "Footer has been successfully added"

    ' Macro1 Macro
    ' Macro recorded 02/05/2012 by Jones.Pulikotil
    '
    ' Keyboard Shortcut: Ctrl+t
    '
    ' With ActiveSheet.PageSetup
    ' .PrintTitleRows = ""
    ' .PrintTitleColumns = ""
    ' End With
    ' ActiveSheet.PageSetup.PrintArea = ""
    ' With ActiveSheet.PageSetup
    ' .LeftHeader = ""
    ' .CenterHeader = ""
    ' .RightHeader = ""
    ' .LeftFooter = ""
    ' .CenterFooter = "Confidential"
    ' .RightFooter = ""
    ' .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 Sub

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    For Word, the basics are:
    [VBA]Sub FooterSAS()
    Select Case InputBox("Enter 1=Public, 2=Internal Use 3=Confidential 4=Secret")
    Case Is = 1: x = "The classification of this document is: Public"
    Case Is = 2: x = "The classification of this document is: Only for Internal Use"
    Case Is = 3: x = "The classification of this document is: Confidential"
    Case Is = 4: x = "The classification of this document is: Secret"
    Case Else
    End Select
    ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = x
    End Sub[/VBA]
    Note: Please use the VBA tags when posting code.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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