PDA

View Full Version : Solved: Excel 2003 Workbook Open Code



MWGainesJr
12-15-2008, 08:42 AM
I have Some code written in a project that creates a Custom Toolbar, Places a Custom button on it, Assigns a macro to it and it works just fine.

However, I can't for the life of me figure out how to:

1. Make the button only show it's text name instead of the smiley face

2. Dock the toolbar

Is this possible? And if so help would be greatly appreciated.

Thanks,

MWGainesJr

Simon Lloyd
12-15-2008, 09:53 AM
Welcome to VBAX!

Would you care to show us the code you are using to create this itme so we can better help you with your query?

MWGainesJr
12-15-2008, 11:44 AM
Welcome to VBAX!

Would you care to show us the code you are using to create this itme so we can better help you with your query?

Private Sub Workbook_Open()
Dim ClassOf2010 As CommandBar
Dim Internship_1 As CommandBarButton
Set ClassOf2010 = Application.CommandBars.Add
With ClassOf2010
.Name = "Class of 2010"
.Position = msoBarLeft
.Visible = True
Set Internship_1 = .Controls.Add(msoControlButton)
End With
With Internship_1
.OnAction = "Show_Internship_1"
.Caption = "Internship 1"
End With
End Sub

I've got it docked now but I still need the button to have a label. I've managed to take the Smiley away but right now it is just a blank space on the bar that can be clicked. I'd like to show its text caption.

Thanks for the help.

MWGainesJr
12-15-2008, 12:10 PM
Welcome to VBAX!

Would you care to show us the code you are using to create this itme so we can better help you with your query?

Nevermind. I figured it out.

.style = msobuttoncaption

Thanks for your help though guys. I'll be sure to come back here from now on for help.