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

anyone familiar with '.pasteFace.?

Status
Not open for further replies.

LikeThisName

Vendor
May 16, 2002
288
US

what library do i need to reference to use .PasteFace

or can some1 tell me another way to add an icon/gif to my custom menu bar, instead of a faceid.

Thanks much appreciated.
 
PasteFace is a member of the CommandBarButton class in the MS Office library.

HTH
Mike
 
Sample to create toolbar on right with four custom button images:

Sub Auto_Open()
savestate = ActiveWorkbook.Saved
On Error Resume Next
NumTools = 4
For i = 1 To NumTools
pn = "Picture" & Application.Trim(Str(i))
Sheets("Variables").DrawingObjects(pn).Width = 16
Sheets("Variables").DrawingObjects(pn).Height = 15
Next i

tb = "CJERPT Toolbar"
Appplication.Toolbars(tb).Delete
On Error GoTo ErrorHandler
Application.Toolbars.Add (tb)

Name1 = "Open 1st month and format"
Name2 = "Open 2nd month and format"
Name3 = "Prepare the CJE report"
Name4 = "Save the report"

With Application.Toolbars(tb)

.ToolbarButtons.Add 231, , "GetMonthOne"
.ToolbarButtons.Add 231, , "GetMonthTwo"
.ToolbarButtons.Add 231, , "MakeStuff"
.ToolbarButtons.Add 231, , "Save_RPT"

.ToolbarButtons(1).Name = Name1
.ToolbarButtons(2).Name = Name2
.ToolbarButtons(3).Name = Name3
.ToolbarButtons(4).Name = Name4
End With

For i = 1 To NumTools
Sheets("Variables").DrawingObjects("Picture " & i).Copy
Toolbars(tb).ToolbarButtons(i).PasteFace
Next i

Application.Toolbars(tb).Position = xlRight

With Application.Toolbars(tb)
.Width = 141
.Top = 1
.Left = 1
.Visible = True
End With

ErrorHandler:
On Error Resume Next
Application.Toolbars(tb).Visible = True
Application.Toolbars(tb).Position = xlRight
ActiveWorkbook.Saved = savestate

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top