![]() |
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. |
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. |
All times are GMT +1. The time now is 11:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com