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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building Icons with VBA (Powerpoint 2000)

Status
Not open for further replies.

tgmoon

Technical User
Jan 31, 2001
54
GB
I've been hunting around the net to no avail trying to find out a way of building icon faces using VBA, (or if i even need to!!)

I'm building a powerpoint add-in and need to create custom icons. I've no problem building the toolbar and adding icons, and adding MS predefined graphics, but none of these are any good for what i'm trying to portray.

If anyone has any idea, or can point me in the right direction i'd be very grateful.

Many thanks

Thom
 
In Excel 4.0 I used to convert icons to bitmap files and then paste them onto a spreadsheet (as bitmaps). Within the code I would set the picture on a button to "Picture1" or "Picture2" or whatever. I don't know if you could paste your icons onto a hidden page in powerpoint but it might be worth a try.

Pasting the images as .ico files didn't work.

Greg
 
Thanks Greg.

I managed it to do in the end. In the code i got powerpoint to create the shape and fill then cut it, and use the pasteface function to create the icon image. Seemed a bit long winded but seems to do the trick.

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(25, 61, 133)
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(25, 61, 133)
.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)
On Error Resume Next
wealth1.OnAction = "Functions.WM1"
On Error Resume Next
wealth1.PasteFace
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top