Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powerpoint VBA Button Face code

Status
Not open for further replies.

tgmoon

Technical User
Jan 31, 2001
54
GB
Hi.

I've come up with the following (and probably not very good) code to create a custom toolbar and button face in VBA.

Sub addBar()
ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 162.25, 265.5, 44.75, 32#).Select
With ActiveWindow.Selection.ShapeRange
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(111, 75, 183)
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(111, 75, 183)
.Line.BackColor.RGB = RGB(255, 255, 255)
.Height = 15#
.Width = 15#
End With
ActiveWindow.Selection.Cut
Set myBar = CommandBars _
.Add(Name:="WM color", Position:=msoBarTop, Temporary:=True)
myBar.Visible = True
Set wealth1 = myBar.Controls _
.Add(Type:=msoControlButton, Id:=CommandBars("Standard").Controls("Copy").Id)
wealth1.OnAction = "ShowColor"
wealth1.PasteFace

End Sub

Could anyone let me know if the above is the logical way to go around things and give me any pointers as to if it can be slimmed down, as i've got to create at least 36 more buttons!

many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top