ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Invalid procedure call or argument (https://www.excelbanter.com/excel-programming/422350-re-invalid-procedure-call-argument.html)

JE McGimpsey

Invalid procedure call or argument
 
Check your RemoveOSIMenubar routine. It's not removing the
"OSILogInsertROw" CommandBar.


In article ,
salgud wrote:

I've tried at least a dozen variations on creating this command bar, none
of which works:

Sub CreateOSIMenubar()

Dim vMacNames As Variant
Dim vCapNames As Variant
Dim vTipText As Variant
Dim cbOSI As CommandBar
Call RemoveOSIMenubar

vMacNames = "OSILogInsertRow"
vCapNames = "OSILogInsertRow"
vTipText = "Add Row"
Set cbOSI = CommandBars.Add
With cbOSI
.Name = vMacNames <--- Invalid Procedure call or argument
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarTop
.Left = CommandBars("FormatDGB").Left + CommandBars("FormatDGB").Width
.RowIndex = CommandBars("FormatDGB").RowIndex
End With
With CommandBars("OSILogInsertRow").Controls.Add(Type:= msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "OSILogInsertRow"
.Caption = vCapNames
.Style = msoButtonCaption
.TooltipText = vTipText
End With
End Sub

I've typed in the text string instead of the variable, changed the variable
to a string, etc, etc.
Does anyone see what's wrong here?



All times are GMT +1. The time now is 12:50 AM.

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