Frame a slide with a rectangle
Problem
You want to "frame" a slide or slides with a rectangle.
Solution
The FrameASlide subroutine below will add a rectangle of the line thickness you request to a single slide.
The other Subroutines call it to do their work, either on the current slide or on all slides in the current presentation.
Sub CurrentSlide() ' This subroutine calls FrameASlide and passes it ' the current active slide. Call FrameASlide(ActiveWindow.Selection.SlideRange(1)) End Sub Sub AllSlides() ' This calls FrameASlide for each slide in the presentation Dim oSld as Slide For Each oSld in ActivePresentation.Slides Call FrameASlide(oSld) Next End Sub Sub FrameASlide(oSld as Slide) Dim sngLinewidth As Single Dim oFrameShape As Shape Dim sngSlidewidth As Single Dim sngSlideheight As Single Dim oSld As Slide Dim sngOffset As Single ' EDIT: sngLinewidth = 2 ' frame outline thickness in points ' NO MORE EDITS sngOffset = sngLinewidth / 2 With ActivePresentation.PageSetup sngSlidewidth = .Slidewidth sngSlideheight = .Slideheight End With With oSld Set oFrameShape = .Shapes.AddShape(msoShapeRectangle, _ 0 + sngOffset, _ 0 + sngOffset, _ sngSlidewidth - sngOffset, _ sngSlideheight - sngOffset) End With With oFrameShape With .Line .Weight = sngLinewidth .ForeColor.RGB = RGB(0, 0, 0) ' black End With With .Fill .Visible = msoFalse End With End With End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.