Customizing VBEnvironment command bar oddities

BartH

New Member
Joined
Jul 4, 2006
Messages
14
Hi group,

In the VBEditor environment, I have some customizations to the commands in the command bars.
Sometimes errors cause all changes to be reset, so I decided to put some code together to make the changes programmatically.

Now there are some strange results and I am looking for answers, I hope you might be able to provide:
  1. when adding the Compile command
    VBA Code:
    Application.VBE.CommandBars("Standard").Controls.Add 1, 578
    the result is:
    VBIDE 1.jpg


    while when adding it manually, the result is:
    VBIDE 4.jpg


    Why the difference, and why doesn't Compile All &Modules do anything?

  2. When I add a default control
    VBA Code:
    Application.VBE.CommandBars("Debug") .Controls.Add msoButtonIcon, 579, , 3
    it works fine, but it stops working after I change the FaceId
    VBA Code:
    Application.VBE.CommandBars("Debug") .Controls(6).FaceId = 9724
    Why?

  3. Where are changes to the VBE command bars stored and could they be restored when stored and re-applied?
    I found some reports of them being stored in the registry and also it would be in a xlb (xlsb now?) file.
    What is modern truth and coherence here?
Am looking forward to your useful answers,
Grtz Bart
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
PS

I found a way to store settings in the registry:
VBA Code:
        SaveSetting appname:="DeBugBar", section:="CMD" & ctrl.ID, key:="BeginGroup", setting:=ctrl.BeginGroup
        SaveSetting appname:="DeBugBar", section:="CMD" & ctrl.ID, key:="Index", setting:=ctrl.Index
        SaveSetting appname:="DeBugBar", section:="CMD" & ctrl.ID, key:="ID", setting:=ctrl.ID
        SaveSetting appname:="DeBugBar", section:="CMD" & ctrl.ID, key:="Caption", setting:=ctrl.Caption
        SaveSetting appname:="DeBugBar", section:="CMD" & ctrl.ID, key:="FaceId", setting:=ctrl.FaceId

1707561324553.png


Which can be retrieved with:
VBA Code:
GetSetting(appname:="DeBugBar", section:="CMD1811", key:="<whateveryouneed>")
So could be re-applied like
VBA Code:
Application.VBE.CommandBars("Debug") .Controls.Add msoButtonIcon, _
    GetSetting(appname:="DeBugBar", section:="CMD1811", key:="ID"), ,1
but then still the aforementioned problems exist.
 
Upvote 0

Forum statistics

Threads
1,215,102
Messages
6,123,099
Members
449,096
Latest member
provoking

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top