PDA

View Full Version : Macros for Footer



jonesp_81
07-16-2012, 01:32 AM
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

macropod
07-16-2012, 08:19 PM
For Word, the basics are:
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
Note: Please use the VBA tags when posting code.