View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default 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?