Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default How to set up caption on a button at startup?

Hi,

I have a small spreadsheet with a command button called makebusy.
I also have a macro called Auto_open to automatically run whenever the
worksheet is open.
What I would like to have is that at startup (somehwere in the
auto_open sub) to set up the caption of my button to "start".

The reason is that when the button is clicked I change the caption of
it, and I would like it to start by daefault as "start" whenever the
sheet is opened.

Any help would be appreciated.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default How to set up caption on a button at startup?

I just want to add that the button is not created with Auto_open sub.
It is already in the spreadsheet. I just want to make sure that the
caption is changed to "start"
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default How to set up caption on a button at startup?

maybe: yoursheet.makebusy.caption = "Start"

How do you change the caption in the sub that's triggered by the
button? You should be able to use the same method to change it in the
auto open sub, just refer to it explicitly. (instead of "me.caption"
"yoursheet.makebusy.caption")

Cliff Edwards
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default How to set up caption on a button at startup?

Hi,

There are two types of buttons. Need to know what type. One is created from
the Forms toolbar and the other is and ActiveX control created from the
Control Toolbox toolbar. (Both look alike)

Right click on the button.

If you get a dialog box with a number of options including Cut, Copy Paste
etc then it is a Forms button.

If nothing happens or only a dotted line around just inside the perimeter,
it is an ActiveX control.

Let me know what type of button you have and I'll provide sample code and
instructions on how to identify the button name for the code.


--
Regards,

OssieMac


" wrote:

I just want to add that the button is not created with Auto_open sub.
It is already in the spreadsheet. I just want to make sure that the
caption is changed to "start"
Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default How to set up caption on a button at startup?

Hi,

Thanks for all the help.

It is a Forms button.
I used the control toolbox to create the button adn I do get all those
option when right clicking on it in design mode.
Under properties I gave it the name 'makebusy'.

Thanks again for all the help.

On Nov 21, 1:05 am, OssieMac
wrote:
Hi,

There are two types of buttons. Need to know what type. One is created from
the Forms toolbar and the other is and ActiveX control created from the
Control Toolbox toolbar. (Both look alike)

Right click on the button.

If you get a dialog box with a number of options including Cut, Copy Paste
etc then it is a Forms button.

If nothing happens or only a dotted line around just inside the perimeter,
it is an ActiveX control.

Let me know what type of button you have and I'll provide sample code and
instructions on how to identify the button name for the code.

--
Regards,

OssieMac



" wrote:
I just want to add that the button is not created with Auto_open sub.
It is already in the spreadsheet. I just want to make sure that the
caption is changed to "start"
Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default How to set up caption on a button at startup?

Hi again,

If created under the Control Toolbox it is actually an ActiveX control. You
do see the dialog box if the Design mode is turned on when you right click
it. With a Forms button, you don't use Design Mode and you see the dialog box
simply by right clicking on the button.

Anyway example of code the code is:-

Sheets("Sheet1").CommandButton1.Caption = "Start"

You said that you gave it the name 'makebusy'. Did you mean the Name or the
Caption? They are different. In the above code CommandButton1 is the name.
You can see both name and caption in Properties. If 'makebusy' is the name
then your code will be:-

Sheets("Sheet1").makebusy.Caption = "Start"

Of course you will need to edit the sheet name to suit your sheet name.

Or if it is on a userform then:-

UserForm1.makebusy.Caption = "Start"

Again you will need to edit the userform name to suit your userform.

Hope this helps. Feel free to get back to me if you have any further
problems with it.

--
Regards,

OssieMac


" wrote:

Hi,

Thanks for all the help.

It is a Forms button.
I used the control toolbox to create the button adn I do get all those
option when right clicking on it in design mode.
Under properties I gave it the name 'makebusy'.

Thanks again for all the help.

On Nov 21, 1:05 am, OssieMac
wrote:
Hi,

There are two types of buttons. Need to know what type. One is created from
the Forms toolbar and the other is and ActiveX control created from the
Control Toolbox toolbar. (Both look alike)

Right click on the button.

If you get a dialog box with a number of options including Cut, Copy Paste
etc then it is a Forms button.

If nothing happens or only a dotted line around just inside the perimeter,
it is an ActiveX control.

Let me know what type of button you have and I'll provide sample code and
instructions on how to identify the button name for the code.

--
Regards,

OssieMac



" wrote:
I just want to add that the button is not created with Auto_open sub.
It is already in the spreadsheet. I just want to make sure that the
caption is changed to "start"
Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change caption of a button Dylan @ UAFC[_2_] Excel Worksheet Functions 3 November 25th 08 07:04 PM
Copy button caption John Pierce Excel Programming 2 August 16th 07 04:58 PM
Toggle Button Caption Al Excel Programming 5 October 20th 06 08:06 PM
How to change Button Caption? BrianB Excel Programming 3 June 1st 05 06:24 PM
Caption of a button Dr_Phil Excel Programming 4 May 4th 04 09:13 PM


All times are GMT +1. The time now is 02:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"