+ Reply to Thread
Results 1 to 2 of 2

Make more info appear when mouse moves over a macro command button

  1. #1
    Jeff at Bosch Corp.
    Guest

    Make more info appear when mouse moves over a macro command button

    I am a first user to macros. I am trying to make a flow chart where there is
    only numbers visible on the command button, but when a user slides the mouse
    over the button, more information appears such as what happens when you add a
    comment to a cell. Also when the user clicks on the button it will link to
    another spreadsheet, however I already have this linking system set up.

  2. #2
    K Dales
    Guest

    RE: Make more info appear when mouse moves over a macro command button

    Do you mean like a tooltip, a text box that pops up when you are over the
    button? CommandButtons have a MouseMove event that can trigger code when the
    mouse is over them (but only CommandButtons from the Controls Toolbox; not
    the Forms Toolbar!). The only thing is I can't (yet) find a way to run code
    to make the box go away automatically if you move off the button. But here
    is what you can do at least get started:

    Create the CommandButton from the Toolbox, and put a textbox nearby - set
    them up so they appear the way you want them to appear when the textbox
    shows, but when done set the TextBox's Visible property to be False.

    Now you need to go into the VBA editor and make sure the Project Explorer is
    showing. In there, select the line that shows the worksheet where your
    button is. Then, in the code pane put the following (note: assumes your
    button's name is CommandButton1 and TextBox is TextBox1):

    Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As
    Integer, ByVal X As Single, ByVal Y As Single)

    TextBox1.Visible = True

    End Sub

    Now when you mouse over the button the textbox the textbox should pop up.
    But as I said there is no way I found to make it disappear if you then move
    the mouse away from the button - you may need to put another "Close" button
    that appears as "part of" your textbox (i.e. on top of it), then do this:

    Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As
    Integer, ByVal X As Single, ByVal Y As Single)

    TextBox1.Visible = True
    CommandButton2.Visible = True

    End Sub

    Private Sub CommandButton2_Click()

    TextBox1.Visible = False
    CommandButton2.Visible = False

    End Sub

    A little bit crude, but functional. Perhaps might meet your needs.

    "Jeff at Bosch Corp." wrote:

    > I am a first user to macros. I am trying to make a flow chart where there is
    > only numbers visible on the command button, but when a user slides the mouse
    > over the button, more information appears such as what happens when you add a
    > comment to a cell. Also when the user clicks on the button it will link to
    > another spreadsheet, however I already have this linking system set up.


+ 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