VBA To Add A Confidentiality Footer Statement In Excel, Word, or PowerPoint

General Code Vault Banner v2.jpg

What This VBA Code Does

When handling sensitive data it is vital to display some sort of statement to let the reader know that the information they are viewing is confidential and should not be shared.  I've seen these statements used in Excel, Word, and PowerPoint, so below are tailored macros for each Office program.  These VBA macros will allow you to automatically add a confidentiality footer statement to your reports!

VBA To Add A Confidentiality Footer Statement In Excel, Word, or PowerPoint

In Microsoft Excel

Sub InsertConfidentialityFooter()

'PURPOSE: Add confidentiality statement footer to all worksheets in active workbook
'SOURCE: www.TheSpreadsheetGuru.com

Dim sht As Worksheet

'Loop through each worksheet
  For Each sht In ActiveWorkbook.Worksheets
    sht.PageSetup.LeftFooter = ""
    sht.PageSetup.CenterFooter = "&10CONFIDENTIAL - INTERNAL USE ONLY" 'size 10 font
    sht.PageSetup.RightFooter = ""
    sht.DisplayPageBreaks = False
  Next sht

End Sub

In Microsoft Word

Sub InsertConfidentialityFooter()

'PURPOSE: Add confidentiality statement footer to active document
'SOURCE: www.TheSpreadsheetGuru.com

With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
  .Text = "CONFIDENTIAL - INTERNAL USE ONLY"
  .ParagraphFormat.Alignment = wdAlignParagraphCenter
  .Font.Size = 10 'size 10 font
End With

End Sub

In Microsoft PowerPoint

Sub InsertConfidentialityFooter()

'PURPOSE: Add confidentiality statement footer to all slides in active presentation
'SOURCE: www.TheSpreadsheetGuru.com

Dim sld As Slide
Dim shp As Shape

'Loop through each slide in Active Presentation
  For Each sld In ActivePresentation.Slides
  
    'Test to see if footer exists in Slide Master
      On Error Resume Next
        sld.HeadersFooters.Footer.Visible = msoTrue
      
        If Err.Number <> 0 Then
          'Add Footer To Slide Master
            Call sld.Master.Shapes.AddPlaceholder _
              (ppPlaceholderFooter, 246, 500.5, 228, 28.75)
        End If
      On Error GoTo 0
      
    'Add Footer Text
      sld.HeadersFooters.Footer.Visible = msoTrue
      sld.HeadersFooters.Footer.Text = "CONFIDENTIAL - INTERNAL USE ONLY"
  
  Next

End Sub

How Do I Modify This To Fit My Specific Needs?

Chances are this post did not give you the exact answer you were looking for. We all have different situations and it's impossible to account for every particular need one might have. That's why I want to share with you: My Guide to Getting the Solution to your Problems FAST! In this article, I explain the best strategies I have come up with over the years to getting quick answers to complex problems in Excel, PowerPoint, VBA, you name it

I highly recommend that you check this guide out before asking me or anyone else in the comments section to solve your specific problem. I can guarantee 9 times out of 10, one of my strategies will get you the answer(s) you are needing faster than it will take me to get back to you with a possible solution. I try my best to help everyone out, but sometimes I don't have time to fit everyone's questions in (there never seem to be quite enough hours in the day!).

I wish you the best of luck and I hope this tutorial gets you heading in the right direction!

Chris "Macro" Newman :)