ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Problem with command button name (https://www.excelbanter.com/excel-discussion-misc-queries/162507-problem-command-button-name.html)

Jason[_9_]

Problem with command button name
 
Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks

Dave Peterson

Problem with command button name
 
And you're positive that you've saved the workbook?

And you're positive that you're opening the workbook that you saved?

One test if you're positive...
Open the workbook
make the changes
save the workbook
close excel

Open excel in safe mode
windows start button|run
excel /safe
file|open your workbook that was just saved

Are the commandbuttons renamed?

If no, then maybe you have a macro that's changing the names of your
commandbuttons each time you open that workbook???

If yes, I don't have a guess.

Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks


--

Dave Peterson

Jason[_9_]

Problem with command button name
 
Hi Dave,

I have actually just noticed that while in Design Mode in the Properties
window the name has been changed, but in the name box it still says
CommandButton1. It's like it not properly changing the name at all!?

Also, how do you check the name of command buttons while in safe mode?
My Developer tab disappeared, and I am not able to re-add it in safe mode,
as well now, none of the names for the command buttons appear in the
name box.

On Wed, 17 Oct 2007 15:59:32 -0500, Dave Peterson wrote:

And you're positive that you've saved the workbook?

And you're positive that you're opening the workbook that you saved?

One test if you're positive...
Open the workbook
make the changes
save the workbook
close excel

Open excel in safe mode
windows start button|run
excel /safe
file|open your workbook that was just saved

Are the commandbuttons renamed?

If no, then maybe you have a macro that's changing the names of your
commandbuttons each time you open that workbook???

If yes, I don't have a guess.



Jason[_9_]

Problem with command button name
 
Hmmm, is there a limit on the amount of character one can use for a
command button name? I have just noticed that all the buttons I am having
problems renaming would have names that are a little bit longer than the
buttons where renaming has worked.

3 buttons not allowing rename:
1st name is 35 chars long
2nd name is 33 chars long
3rd name is 36 chars long

Almost all the other names are under 30 chars long.

On Wed, 17 Oct 2007 21:54:41 +0000, Jason wrote:

Hi Dave,

I have actually just noticed that while in Design Mode in the Properties
window the name has been changed, but in the name box it still says
CommandButton1. It's like it not properly changing the name at all!?

Also, how do you check the name of command buttons while in safe mode?
My Developer tab disappeared, and I am not able to re-add it in safe mode,
as well now, none of the names for the command buttons appear in the
name box.

On Wed, 17 Oct 2007 15:59:32 -0500, Dave Peterson wrote:

And you're positive that you've saved the workbook?

And you're positive that you're opening the workbook that you saved?

One test if you're positive...
Open the workbook
make the changes
save the workbook
close excel

Open excel in safe mode
windows start button|run
excel /safe
file|open your workbook that was just saved

Are the commandbuttons renamed?

If no, then maybe you have a macro that's changing the names of your
commandbuttons each time you open that workbook???

If yes, I don't have a guess.



Jason[_9_]

Problem with command button name
 
Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks



Gord Dibben

Problem with command button name
 
Jason

With button from Control Toolbox or Forms Toolbar I can get way more than 32
characters to appear after save/close and re-open.


Gord Dibben MS Excel MVP

On Wed, 17 Oct 2007 22:28:29 GMT, Jason wrote:

Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks



Jason[_9_]

Problem with command button name
 
Gord

It seemed like a pretty low number to me, but once I reduced the names to
32 chars or less, all my problematic buttons started to work right. What
can I say? Wierd.
Any thoughts why this might be the case?

On Wed, 17 Oct 2007 15:58:53 -0700, Gord Dibben wrote:

Jason

With button from Control Toolbox or Forms Toolbar I can get way more than 32
characters to appear after save/close and re-open.


Gord Dibben MS Excel MVP

On Wed, 17 Oct 2007 22:28:29 GMT, Jason wrote:

Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks



Gord Dibben

Problem with command button name
 
Sorry, not a clue.

Not something I work with very often so unfamiliar.


Gord

On Wed, 17 Oct 2007 23:18:42 GMT, Jason wrote:

Gord

It seemed like a pretty low number to me, but once I reduced the names to
32 chars or less, all my problematic buttons started to work right. What
can I say? Wierd.
Any thoughts why this might be the case?

On Wed, 17 Oct 2007 15:58:53 -0700, Gord Dibben wrote:

Jason

With button from Control Toolbox or Forms Toolbar I can get way more than 32
characters to appear after save/close and re-open.


Gord Dibben MS Excel MVP

On Wed, 17 Oct 2007 22:28:29 GMT, Jason wrote:

Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks



Dave Peterson

Problem with command button name
 
I got 31 in this (only the commandbutton on the worksheet):

Option Explicit
Private Sub CommandButton1_Click()
With Me.OLEObjects(1)
Debug.Print .Name
.Name = String(32, "a")
Debug.Print .Name & "--" & Len(.Name)
End With
End Sub

CommandButton1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa--31

Even though I tried to use 32 characters, it was truncated.

And if I changed it to:
..Name = String(33, "a")
I got a run time error.



Jason wrote:

Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks


--

Dave Peterson

Gord Dibben

Problem with command button name
 
My error I guess.

I was thinking of the Button Caption


Gord

On Wed, 17 Oct 2007 19:37:53 -0500, Dave Peterson
wrote:

I got 31 in this (only the commandbutton on the worksheet):

Option Explicit
Private Sub CommandButton1_Click()
With Me.OLEObjects(1)
Debug.Print .Name
.Name = String(32, "a")
Debug.Print .Name & "--" & Len(.Name)
End With
End Sub

CommandButton1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa--31

Even though I tried to use 32 characters, it was truncated.

And if I changed it to:
.Name = String(33, "a")
I got a run time error.



Jason wrote:

Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the name
that I entered has reverted back to the default "CommandButton1". Any idea
what is going on here?

Thanks



George Nicholson

Problem with command button name
 
This is all a guess:

You may be able to give a command button a name longer that 32 characters,
but my guess is that the 1st 32 are all that matters. It may be that those
32 characters have to be unique among all command buttons names (maybe among
all control/shape/object names) and any additional characters are
essentially ignored.

If the first 32 characters of a name are not unique the name will not be
accepted and will not 'stick'.



"Jason" wrote in message
om...
Gord

It seemed like a pretty low number to me, but once I reduced the names to
32 chars or less, all my problematic buttons started to work right. What
can I say? Wierd.
Any thoughts why this might be the case?

On Wed, 17 Oct 2007 15:58:53 -0700, Gord Dibben wrote:

Jason

With button from Control Toolbox or Forms Toolbar I can get way more than
32
characters to appear after save/close and re-open.


Gord Dibben MS Excel MVP

On Wed, 17 Oct 2007 22:28:29 GMT, Jason
wrote:

Turns out my problem was that the descriptive names I had chosen for the
Command Buttons were too long. 32 characters seems to be the limit.

Thank you Dave for your suggestion.

On Wed, 17 Oct 2007 19:42:34 +0000, Jason wrote:

Hi,

I am having a strange problem.
I have a workbook with 20 or so sheet, and on each sheet is a command
button. I have changed the default name of most of the command buttons
to
better reflect its purpose, but a couple of them have been giving me
trouble.
I can change the name, and it stays that way while I have the workbook
open. But once I save the workbook, close it and then reopen it, the
name
that I entered has reverted back to the default "CommandButton1". Any
idea
what is going on here?

Thanks






All times are GMT +1. The time now is 09:47 PM.

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