ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   custom commandbarPopup control - how to return its identifer? (https://www.excelbanter.com/excel-programming/380118-re-custom-commandbarpopup-control-how-return-its-identifer.html)

Jim Rech

custom commandbarPopup control - how to return its identifer?
 
While you can get the popup's name it's easier just to set a variable to it
like this:

Dim MyPopup As CommandBarPopup
Set MyPopup =
Application.CommandBars("Formatting").Controls.Add (Type:=msoControlPopup, _
Befo=20)
MyPopup.Controls.Add msoControlButton
'etc

--
Jim
"Rich" wrote in message
...
| Hello,
|
| I have recorded macros where I add a NewMenu control to the formatting
| toolbar and add some macro buttons. Here is what the recorded macro
returns:
| ---------------------------------------------------------------------------------------
| Application.CommandBars("Formatting").Controls.Add Type:=msoControlPopup,
_
| Befo=20
| Application.CommandBars("Custom Popup 86682718").Controls.Add Type:= _
| msoControlButton, ID:=2950, Befo=1
| Application.CommandBars("Custom Popup 86682718").Controls.Add Type:= _
| msoControlButton, ID:=2950, Befo=2
| --------------------------------------------------------------------------------------
|
| I want to duplicate this using VBA code, but I have no idea how to
retrieve
| this identifier "Custom Popup 86682718". If I record another macro where
I
| add another NewMenu Item it comes up with a different identifier like
|
| CommandBars("Custom Popup 13514682")....
|
| how can I retrieve this identifier? I have tried
|
| Dim cb As CommandBar, ctl As CommandBarControl
| Set cb = CommandBars("Formatting")
| For Each ctl In cb.Controls
| Debug.print ctl.Caption & " " & ctl.ID & " " & ctl.Index
| Next
|
| But nothing returns the identifier for the control. How can this
identifier
| be returned/retrieved?
|
| Thanks,
| Rich
|




All times are GMT +1. The time now is 03:35 AM.

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