CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    2

    How to add command button to menu

    I need help adding a command button to a menu. I have a command button that when pushed it should open up a menu, and on the menu I need a command button to appear there. Could anyone help me? It would be much appreciated. Thanks


  2. #2
    Join Date
    May 2001
    Location
    Big Flats, NY, USA
    Posts
    5

    Re: How to add command button to menu

    Something like this perhaps?

    Dim CBCitem as CommandBarControl
    set CBCitem = CommandBars("Tools").Controls.Add(Type:=msoControlButton, before:=3)
    With CBCitem
    .Caption = "Your &Text Here..."
    .FaceId = 0
    .OnAction = "YourSubHere"
    End With



    Or did you want something on a UserForm? In that case, the sub you refer to in OnAction should call YourForm.Show, assuming you have created the form and named it YourForm.



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

Featured