+ Reply to Thread
Results 1 to 3 of 3

[SOLVED] Create floating button based on button click in menu

  1. #1
    ExcelMonkey
    Guest

    [SOLVED] Create floating button based on button click in menu

    I have a menu that I install. I create a button in the menu. What I now
    want to do is on the Onaction Property tell VBA to create a floating button
    that pops up on my screen. I then want to attach that button to another
    macro. So I only want this floating button to appear when I click on the
    button in my menu. And I want it to float on my screen so that I can close
    it when I do not need it. Does anyone know how to do this?


    Sub MenuSetup()
    Dim MenuBar As CommandBar
    Dim MyMenu
    Dim MySubMenu1 As CommandBarButton

    Set MenuBar = CommandBars.ActiveMenuBar

    Set MyMenu = MenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
    MyMenu.Caption = "&Tools"
    'MyMenu.BeginGroup = True

    '******
    'Create First Button Items
    Set MySubMenu1 = MyMenu.Controls.Add(Type:=msoControlButton, ID:=1,
    Temporary:=True)
    MySubMenu1.Caption = "First Button"
    MySubMenu1.FaceId = 590
    MySubMenu1.OnAction = "Want this to call up floating button"

  2. #2
    K Dales
    Guest

    RE: Create floating button based on button click in menu

    Just create a userform the size of the button and set its ShowModal property
    to false. Put the button on the userform (and put the code in the code
    module) and you can use it whenever you need it, click the close button of
    the userform [X] to make it go away.
    --
    - K Dales


    "ExcelMonkey" wrote:

    > I have a menu that I install. I create a button in the menu. What I now
    > want to do is on the Onaction Property tell VBA to create a floating button
    > that pops up on my screen. I then want to attach that button to another
    > macro. So I only want this floating button to appear when I click on the
    > button in my menu. And I want it to float on my screen so that I can close
    > it when I do not need it. Does anyone know how to do this?
    >
    >
    > Sub MenuSetup()
    > Dim MenuBar As CommandBar
    > Dim MyMenu
    > Dim MySubMenu1 As CommandBarButton
    >
    > Set MenuBar = CommandBars.ActiveMenuBar
    >
    > Set MyMenu = MenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
    > MyMenu.Caption = "&Tools"
    > 'MyMenu.BeginGroup = True
    >
    > '******
    > 'Create First Button Items
    > Set MySubMenu1 = MyMenu.Controls.Add(Type:=msoControlButton, ID:=1,
    > Temporary:=True)
    > MySubMenu1.Caption = "First Button"
    > MySubMenu1.FaceId = 590
    > MySubMenu1.OnAction = "Want this to call up floating button"


  3. #3
    Gary Keramidas
    Guest

    Re: Create floating button based on button click in menu

    i just use this with a togglebutton. when i click the togglebutton, i want
    to hide the commandbutton so the user can't click on it. when they click the
    togglebutton again, i make it visible

    Worksheets("sheet1").commandbutton1.Visible = False

    and

    Worksheets("sheet1").commandbutton1.Visible = True
    --


    Gary


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    >I have a menu that I install. I create a button in the menu. What I now
    > want to do is on the Onaction Property tell VBA to create a floating
    > button
    > that pops up on my screen. I then want to attach that button to another
    > macro. So I only want this floating button to appear when I click on the
    > button in my menu. And I want it to float on my screen so that I can
    > close
    > it when I do not need it. Does anyone know how to do this?
    >
    >
    > Sub MenuSetup()
    > Dim MenuBar As CommandBar
    > Dim MyMenu
    > Dim MySubMenu1 As CommandBarButton
    >
    > Set MenuBar = CommandBars.ActiveMenuBar
    >
    > Set MyMenu = MenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
    > MyMenu.Caption = "&Tools"
    > 'MyMenu.BeginGroup = True
    >
    > '******
    > 'Create First Button Items
    > Set MySubMenu1 = MyMenu.Controls.Add(Type:=msoControlButton, ID:=1,
    > Temporary:=True)
    > MySubMenu1.Caption = "First Button"
    > MySubMenu1.FaceId = 590
    > MySubMenu1.OnAction = "Want this to call up floating button"




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1