![]() |
|
|
| Subject:
Excel VBA commandbutton manipulations
Category: Computers > Software Asked by: astrokoala1-ga List Price: $4.00 |
Posted:
18 Aug 2005 12:47 PDT
Expires: 18 Aug 2005 20:30 PDT Question ID: 557379 |
Hi,
There is a command button on the Excel worksheet that I am trying to
modify or get rid of. In the MS VB editor, in "sheet 1", the code
reads:
Private Sub CommandButton1_Click()
Call RunCalcs
End Sub
However, this code does not specify the property of the commandbutton
that I see on the Excel worksheet itself. (ie. color, dimension,
captions on it) If I delete it, the button is still there.
Now, I placed the following code as an experiment to add another button:
Set Newbutton=sheet1.OLEObjects.Add("Forms.CommandButton.1")
With NewButton
.left=4
.Top=4
.Width=100
.Height=24
.Object.Caption="123"
End With
and the a second button appears on the worksheet with correct
dimension/caption etc. But when I delete the code I just wrote and
re-run the code, the button remains! This is probably very simple but
I am new at VBA and ActiveX... What's going on? |
|
| There is no answer at this time. |
|
| Subject:
Re: Excel VBA commandbutton manipulations
From: myexpertsonline-ga on 18 Aug 2005 20:04 PDT |
Buttons aren't (usually) removed "according" to the code, though it looks like you DID create one using code. A command button CAN be removed by right-clicking it or by using the Drawing selector tool on the Drawing toolbar. References: This one is kind of the opposite of what you want to do, but does explain how it was likely done in the first place: http://www.officearticles.com/misc/methods_to_run_a_macro_in_microsoft_office_applications.htm Drawing tools and the Drawing toolbar: http://www.officearticles.com/misc/drawing_tools_in_microsoft_office.htm |
| Subject:
Re: Excel VBA commandbutton manipulations
From: astrokoala1-ga on 18 Aug 2005 20:29 PDT |
Hmm. For some reason I can edit it on my laptop but not in my office... Anyhow, it seems to be working... thanks for the response. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
| Search Google Answers for |
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |