2021年1月15日星期五

How to expose the controls for MSForms Control commandbar?

I have the following code that creates a menu in the CommandBar named MSForms Control. How can i expose the control names in the CommandBar?

Sub showControls(cmdBarNames As String)  Dim cmdNew As CommandBarButton  Dim myControls As Control  For Each myControls In Application.VBE.CommandBars(cmdBarNames).Controls      Debug.Print myControls.Name  Next myControls  End Sub    Sub testsC()  Call showControls("MSForms Control")  End Sub  

But it errors out on the For Each line with a error 13 type mistmatch. What am I doing wrong?

https://stackoverflow.com/questions/65745527/how-to-expose-the-controls-for-msforms-control-commandbar January 16, 2021 at 09:06AM

没有评论:

发表评论