Results 1 to 5 of 5

Thread: msoControlButtonPopup "Invalid Procedure Call"

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Tampa
    Posts
    3

    msoControlButtonPopup "Invalid Procedure Call"

    I'm trying to create a Custom (blank) CommanBarPopup of Type:=msoControlButtonPopup (would prefer msoControlSplitButtonPopup). Microsofts website hasn't helped at all. Here's what I've got so far.

    Sub Create_MyBar()
    Dim Bar As CommandBar
    Dim Pop As CommandBarPopup

    Set Bar = CommandBars.Add("My Bar")
    Set Pop = Bar.Controls.Add(msoControlButtonPopup)
    End Sub

    On the Line "Set Pop = Bar.Controls.Add(msoControlButtonPopup)" I get an "Invalid Procedure Call".

  2. #2
    Lively Member Daniel McCool's Avatar
    Join Date
    Oct 2002
    Posts
    127
    VB Code:
    1. Set Pop = Bar.Controls.Add([U]Type:=[/U]msoControlButtonPopup)
    "Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Tampa
    Posts
    3
    I tried it with the "Type:=" call and it still gives me an invalid procedure call. I don't understand why I can't create this button with the following code.

    VB Code:
    1. Sub Create_MyBar()
    2.     Dim Bar As CommandBar
    3.     Dim Pop As CommandBarPopup
    4.    
    5.     Set Bar = CommandBars.Add("My Bar")
    6.     Set Pop = Bar.Controls.Add(Type:=msoControlButtonPopup)
    7. End Sub

  4. #4
    Lively Member Daniel McCool's Avatar
    Join Date
    Oct 2002
    Posts
    127
    VB Code:
    1. Dim toolbar As CommandBar
    2.     Set toolbar = CommandBars.Add
    3.  
    4. ' Make sure it is visible
    5.     With toolbar
    6.         .Name = "My Bar"
    7.         .Position = msoBarTop
    8.         .Protection = msoBarNoCustomize
    9.         .Visible = True
    10.     End With
    11.  
    12. 'Load it
    13. Set Button = CommandBars("My Bar").Controls.Add(Type:=msoControlButtonPopup)
    14.  
    15. 'Adjust the button if you want
    16.     With Button
    17.         .OnAction = "Macro1"
    18.         .Style = msoButtonIconAndCaption
    19.         .FaceId = 300
    20.         .caption = "Drop Me Down"
    21.     End With
    Last edited by Daniel McCool; Feb 23rd, 2004 at 01:47 PM.
    "Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Tampa
    Posts
    3
    Here's what I've got now
    VB Code:
    1. Sub Create_MyBar()
    2.     Dim Bar As CommandBar
    3.     Dim Button As CommandBarPopup
    4.    
    5.     Set Bar = CommandBars.Add("My Bar")
    6.     Set Button = CommandBars("My Bar").Controls.Add(Type:=msoControlButtonPopup)
    7. End Sub

    The code does create the CommandBar named "My Bar", but errors out on the Set Button. It's almost like it won't allow acess to creating a msoControlButtonPopup. The buttons I know I can make are msoControlButton, msoControlEdit, msoControlPopup, msoControlDropdown, and msoControlComboBox. This is completely confusing me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width