ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   programmatically change icons on a menubar (https://www.excelbanter.com/excel-programming/368334-programmatically-change-icons-menubar.html)

[email protected]

programmatically change icons on a menubar
 
Hello--how does one programmatically change the icons on a menubar? The
object browser is sort of cryptic on this point. More specifically, I
am looking to remove all icons from the buttons on my add-in menubar.
Thanks, Abe


Bob Phillips

programmatically change icons on a menubar
 
Are you referring to a menu that your addin creates? If so, it will be in
the code that creates the menu, and that would need adjusting.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Hello--how does one programmatically change the icons on a menubar? The
object browser is sort of cryptic on this point. More specifically, I
am looking to remove all icons from the buttons on my add-in menubar.
Thanks, Abe




Peter T

programmatically change icons on a menubar
 
Run ButtonStyles for a few ideas.

Sub newTestBar()
Dim i As Long

On Error Resume Next
CommandBars("TestBar").Delete
On Error GoTo 0

With CommandBars.Add("TestBar", msoBarFloating, False, True)

For i = 1 To 5
With .Controls.Add(msoControlButton)
.Caption = "Button " & i
.FaceId = i + 79
End With
.Visible = True
Next
End With
End Sub

Sub ButtonStyles()
Dim cBar As CommandBar
Dim cbb As CommandBarButton
Dim sty As Long, i As Long

On Error Resume Next
Set cBar = CommandBars("TestBar")
If cBar Is Nothing Then
newTestBar
Set cBar = CommandBars("TestBar")
End If
On Error GoTo 0

sty = msoButtonIcon ' 1
sty = msoButtonCaption ' 2
sty = msoButtonIconAndCaption ' 3

For i = 1 To 3
sty = i
For Each cbb In cBar.Controls
cbb.Style = sty
'to completely remove icon -
'cbb.FaceId = 1 or cbb.BuiltInFace = True
Next
Stop ' look at the bar
Next

' cBar.Delete ' uncomment to delete the bar
End Sub

Regards,
Peter T

wrote in message
oups.com...
Hello--how does one programmatically change the icons on a menubar? The
object browser is sort of cryptic on this point. More specifically, I
am looking to remove all icons from the buttons on my add-in menubar.
Thanks, Abe





All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com