Debug ? .Caption = strCap

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,125
Office Version
  1. 365
Platform
  1. Windows
Hi I have this in my module and I must of done something earlier that I don't know of and when I open an excel sheet I get a break.

Its breaks at .Caption = strCap
and I don't know why also it says commandBarbutton failed

Does anyone know why this is happening thanks

Code:
Function CreateControl(container As Variant, strCap As String, strTip As String, lngType As MsoControlType, Optional tagLine, Optional Macro) As CommandBarControl
    Dim ctrl
    Set ctrl = container.Controls.Add(lngType)
    With ctrl
        .Caption = strCap               <--------- Breaks
        .TooltipText = strTip
        If Not IsMissing(tagLine) Then .Tag = tagLine
        If Not IsMissing(Macro) Then .OnAction = Macro
    End With
    Set CreateControl = ctrl
End Function
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Noticing it now its under a module called mui looks like it comes with 2016 excel. Just don't know what I did earlier for it to debug every time I open sheet up
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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