ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel, vba, command button (https://www.excelbanter.com/excel-programming/300064-excel-vba-command-button.html)

jimx[_2_]

excel, vba, command button
 
how do you change a property of a command button that is on sheet 1 o
excel worksheet FROM subroutine in vba?

does the command button have the same properties like in visual basic?
ex:
sub change()
command.caption = "button1"
command.top = 900
end sub

??
thank yo

--
Message posted from http://www.ExcelForum.com


Chip Pearson

excel, vba, command button
 
If the command button is from the Controls tool bar, use code
like

Worksheets("Sheet1").OLEObjects("CommandButton1"). Object.Caption
= "Text"

If the command button is from the Forms tool bar, use code like

Worksheets("Sheet1").Buttons("Button 1").Text = "Test"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"jimx " wrote in message
...
how do you change a property of a command button that is on

sheet 1 of
excel worksheet FROM subroutine in vba?

does the command button have the same properties like in visual

basic?
ex:
sub change()
command.caption = "button1"
command.top = 900
end sub

??
thank you


---
Message posted from http://www.ExcelForum.com/




Tom Ogilvy

excel, vba, command button
 
worksheets("Sheet1").CommandButton1.Caption = "button1"

Worksheets("Sheet1").CommandButton1.Top = 900

most properties are the same.

--
Regards,
Tom Ogilvy



"jimx " wrote in message
...
how do you change a property of a command button that is on sheet 1 of
excel worksheet FROM subroutine in vba?

does the command button have the same properties like in visual basic?
ex:
sub change()
command.caption = "button1"
command.top = 900
end sub

??
thank you


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:41 AM.

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