PDA

View Full Version : Solved: VBA to format selected object (border)



robbyvegas
10-24-2012, 01:12 PM
Hi,

I'm new here. I'm moderately competent in scripting for Excel, but I'm completely illiterate in PowerPoint VBA. I have a presentation with several text boxes and figures. I'd like to be able to select one, and run a macro that will automatically format the selected object by adding a 1 pt black border to it -- Any suggestions on how to do this?

Thanks!

robbyvegas
10-24-2012, 01:24 PM
Looking around on the forum I've noticed that I should say that I'm using PowerPoint 2007.

Thanks again

robbyvegas
10-24-2012, 01:51 PM
Figured it out:

Sub black_box_borders()

If ActiveWindow.Selection.Type <> ppSelectionShapes Then Exit Sub
With ActiveWindow.Selection.ShapeRange(1)
.Line.ForeColor.RGB = vbBlack
.Line.Weight = 1 'change weight here
End With

End Sub