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?
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?