Old Excel Tool Bar wont create in Excel 2019

cadence

Well-known Member
Joined
Dec 6, 2005
Messages
528
Hi there I had a toolbar that worked well for a long time in Mac Excel 2008. I have just moved to Excel 2019 and I keep getting an syntax error on these.
This routine use to create my toolbar that I had put my own button on. but on on launch I get a run time error 13 - mis matched type on this command.

Set m = CB.Controls.Add(msoControlPopup, , , , True)

Here is the routine it is called in but not sure why it has issue with it. what syntax has changed in VBA to make this incompatible?

Dim m As CommandBarPopup, mi As CommandBarButton
Dim mc As CommandBarComboBox
Dim ctrl As CommandBarControl
If CB Is Nothing Then Exit Sub

'Set mi = m.Controls.Add(msoControlButton, , , , True)
Set mi = CB.Controls.Add(msoControlButton, , , , True)
'With Application.CommandBars.Add(MyCommandBarName, , , , True)
'With .Controls.Add
With mi
.Style = msoButtonCaption ' caption only, no icon, .FaceId not necessary
.Caption = "16. Production Total: " & (Format(Sheets("Budget").Range("C60").Value) & Format(Sheets("Budget").Range("F57").Value, " #,##0.00"))
'.OnAction = "'" & ThisWorkbook.Name & "'!ModeWeatherDomestic"
'.FaceId = 60
'.Style = msoButtonIconAndCaption

End With
' create the menu
Set m = CB.Controls.Add(msoControlPopup, , , , True)
With m
.BeginGroup = blnBeginGroup
'.Style = msoButtonCaption
'.Style = msoButtonIconAndCaption
'.FaceId = 687
.Caption = "Colour"
.TooltipText = " Text Colour"
End With

Set mi = m.Controls.Add(msoControlButton, , , , True)
With mi
.Caption = "Black"
.OnAction = "'" & ThisWorkbook.Name & "'!FormatBlack"
' .FaceId = 2919
'.Style = msoButtonIcon
.TooltipText = "Black Font"
End With

Could any one enligten me as to what I need to do to change it?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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