ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Creating a Command Button on a worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/152636-creating-command-button-worksheet.html)

GeorgeJ

Creating a Command Button on a worksheet
 
I am using Excell 2007 and am trying to set up a command button on a
worksheet to execute a VB routine. Here is what I am doing
While in a particular worksheet, I select the Developer tab and then select
Insert/Form Controls/Button


This creates a new button, in this instance with the name €śButton 7€ť
Using the VCB Editor, I create, in a pre-existing Module,
Private Sub Button7_Click()
MsgBox "Button 7 pressed"
End Sub
Then when I go back into the sheet on which the button was created and
press the button, I do indeed get the message box €śBotton 7 pressed€ť which is
encouraging.
When I right click on the button, I get some limited ability to edit the
button's properties, but I *cannot* change the buttons name. My questions
are

1) How might I get the ability to see the more of buttons
properties,including its name? Might I get the ability to change the
buttons name ? I have been playing around and eliminating buttons and now
when I create a new button it will be Button 8, but I have already
eliminated buttons 5, 6, & 7. Is there any way to get Excel to create
buttons with other names?

2) When Im finished developing my app, I *dont* want the user to be
able to inadvertantly right click on the button and be able to change its
properties, such as its location, size, text, etc. How might I prevent this?


--
-regards


All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com