Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Referencing a Forms Button in a Worksheet

Thanks for the reply Dave. I realize "-" are not allowed, but it did NOT
throw an error when I assigned a name to the forms button on the worksheet,
weird huh? This what I did.

I drew the forms button on the worksheet, didn't assign a macro, but made
sure the button was still selected. Then I put Selection.Name = "Edit
Add-In" in the Immediate Window and bang, it worked! Why? I think I missing
something here.
--
Cheers,
Ryan


"Dave Peterson" wrote:

Did you mean "why did it throw an error with the "-" in the name?"

I'd guess that names that contain the hyphens are illegal. (Not really going
out on a limb for that, huh?)

Ryan H wrote:

Oops, sorry for the misspelling. I didn't cut and paste my code like I
should have. I changed the name of the button to cmbEditAddIn and this code
works great! Why didn't it throw an error with the "-" in the name?

' enable/disable Edit Add-In button
With .Buttons("cmbEditAddIn")

.Enabled = CBool(aryUserInfo(1, 6))

If CBool(aryUserInfo(1, 6)) Then
.Font.ColorIndex = xlAutomatic 'black
Else
.Font.ColorIndex = 48 'grey
End If
End With
--
Cheers,
Ryan

"Dave Peterson" wrote:

First, it's .enabled (with a D)

Second, change the name of the button by replacing the dash with an underscore.
(don't forget to fix the code, too.)

Then try it.

Ryan H wrote:

I have little experience with Forms controls on worksheets. I have a piece
of code that should disable or enable a Forms command button on
Sheets("QUOTE") depending on a value in a cell (True or False). The command
buttons name is Edit_Add-In. I am getting an error saying "Unable to get the
Buttons property of the Worksheets class". Any ideas? Thanks in Advance!

' fill array with all users information
aryUserInfo = Range(Cells(1, "B"), Cells(1, "G")).Value

' enable/disable Edit Add-In button
ErrorSheets("QUOTE").Buttons("Edit_Add-In").Enable = CBool(aryUserInfo(1,
6))
--
Cheers,
Ryan

--

Dave Peterson
.


--

Dave Peterson
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing a Forms Button in a Worksheet

I don't have an answer for that. To me, it appears to be a bug.

Ryan H wrote:

Thanks for the reply Dave. I realize "-" are not allowed, but it did NOT
throw an error when I assigned a name to the forms button on the worksheet,
weird huh? This what I did.

I drew the forms button on the worksheet, didn't assign a macro, but made
sure the button was still selected. Then I put Selection.Name = "Edit
Add-In" in the Immediate Window and bang, it worked! Why? I think I missing
something here.
--
Cheers,
Ryan

"Dave Peterson" wrote:

Did you mean "why did it throw an error with the "-" in the name?"

I'd guess that names that contain the hyphens are illegal. (Not really going
out on a limb for that, huh?)

Ryan H wrote:

Oops, sorry for the misspelling. I didn't cut and paste my code like I
should have. I changed the name of the button to cmbEditAddIn and this code
works great! Why didn't it throw an error with the "-" in the name?

' enable/disable Edit Add-In button
With .Buttons("cmbEditAddIn")

.Enabled = CBool(aryUserInfo(1, 6))

If CBool(aryUserInfo(1, 6)) Then
.Font.ColorIndex = xlAutomatic 'black
Else
.Font.ColorIndex = 48 'grey
End If
End With
--
Cheers,
Ryan

"Dave Peterson" wrote:

First, it's .enabled (with a D)

Second, change the name of the button by replacing the dash with an underscore.
(don't forget to fix the code, too.)

Then try it.

Ryan H wrote:

I have little experience with Forms controls on worksheets. I have a piece
of code that should disable or enable a Forms command button on
Sheets("QUOTE") depending on a value in a cell (True or False). The command
buttons name is Edit_Add-In. I am getting an error saying "Unable to get the
Buttons property of the Worksheets class". Any ideas? Thanks in Advance!

' fill array with all users information
aryUserInfo = Range(Cells(1, "B"), Cells(1, "G")).Value

' enable/disable Edit Add-In button
ErrorSheets("QUOTE").Buttons("Edit_Add-In").Enable = CBool(aryUserInfo(1,
6))
--
Cheers,
Ryan

--

Dave Peterson
.


--

Dave Peterson
.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Referencing a Forms Button in a Worksheet

When you find something like this, should I notify Microsoft or let it be?
--
Cheers,
Ryan


"Dave Peterson" wrote:

I don't have an answer for that. To me, it appears to be a bug.

Ryan H wrote:

Thanks for the reply Dave. I realize "-" are not allowed, but it did NOT
throw an error when I assigned a name to the forms button on the worksheet,
weird huh? This what I did.

I drew the forms button on the worksheet, didn't assign a macro, but made
sure the button was still selected. Then I put Selection.Name = "Edit
Add-In" in the Immediate Window and bang, it worked! Why? I think I missing
something here.
--
Cheers,
Ryan

"Dave Peterson" wrote:

Did you mean "why did it throw an error with the "-" in the name?"

I'd guess that names that contain the hyphens are illegal. (Not really going
out on a limb for that, huh?)

Ryan H wrote:

Oops, sorry for the misspelling. I didn't cut and paste my code like I
should have. I changed the name of the button to cmbEditAddIn and this code
works great! Why didn't it throw an error with the "-" in the name?

' enable/disable Edit Add-In button
With .Buttons("cmbEditAddIn")

.Enabled = CBool(aryUserInfo(1, 6))

If CBool(aryUserInfo(1, 6)) Then
.Font.ColorIndex = xlAutomatic 'black
Else
.Font.ColorIndex = 48 'grey
End If
End With
--
Cheers,
Ryan

"Dave Peterson" wrote:

First, it's .enabled (with a D)

Second, change the name of the button by replacing the dash with an underscore.
(don't forget to fix the code, too.)

Then try it.

Ryan H wrote:

I have little experience with Forms controls on worksheets. I have a piece
of code that should disable or enable a Forms command button on
Sheets("QUOTE") depending on a value in a cell (True or False). The command
buttons name is Edit_Add-In. I am getting an error saying "Unable to get the
Buttons property of the Worksheets class". Any ideas? Thanks in Advance!

' fill array with all users information
aryUserInfo = Range(Cells(1, "B"), Cells(1, "G")).Value

' enable/disable Edit Add-In button
ErrorSheets("QUOTE").Buttons("Edit_Add-In").Enable = CBool(aryUserInfo(1,
6))
--
Cheers,
Ryan

--

Dave Peterson
.


--

Dave Peterson
.


--

Dave Peterson
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing a Forms Button in a Worksheet

It's up to you. I'm sure there's a link somewhere on their site to report
problems. Somewhere.

Ryan H wrote:

When you find something like this, should I notify Microsoft or let it be?
--
Cheers,
Ryan

"Dave Peterson" wrote:

I don't have an answer for that. To me, it appears to be a bug.

Ryan H wrote:

Thanks for the reply Dave. I realize "-" are not allowed, but it did NOT
throw an error when I assigned a name to the forms button on the worksheet,
weird huh? This what I did.

I drew the forms button on the worksheet, didn't assign a macro, but made
sure the button was still selected. Then I put Selection.Name = "Edit
Add-In" in the Immediate Window and bang, it worked! Why? I think I missing
something here.
--
Cheers,
Ryan

"Dave Peterson" wrote:

Did you mean "why did it throw an error with the "-" in the name?"

I'd guess that names that contain the hyphens are illegal. (Not really going
out on a limb for that, huh?)

Ryan H wrote:

Oops, sorry for the misspelling. I didn't cut and paste my code like I
should have. I changed the name of the button to cmbEditAddIn and this code
works great! Why didn't it throw an error with the "-" in the name?

' enable/disable Edit Add-In button
With .Buttons("cmbEditAddIn")

.Enabled = CBool(aryUserInfo(1, 6))

If CBool(aryUserInfo(1, 6)) Then
.Font.ColorIndex = xlAutomatic 'black
Else
.Font.ColorIndex = 48 'grey
End If
End With
--
Cheers,
Ryan

"Dave Peterson" wrote:

First, it's .enabled (with a D)

Second, change the name of the button by replacing the dash with an underscore.
(don't forget to fix the code, too.)

Then try it.

Ryan H wrote:

I have little experience with Forms controls on worksheets. I have a piece
of code that should disable or enable a Forms command button on
Sheets("QUOTE") depending on a value in a cell (True or False). The command
buttons name is Edit_Add-In. I am getting an error saying "Unable to get the
Buttons property of the Worksheets class". Any ideas? Thanks in Advance!

' fill array with all users information
aryUserInfo = Range(Cells(1, "B"), Cells(1, "G")).Value

' enable/disable Edit Add-In button
ErrorSheets("QUOTE").Buttons("Edit_Add-In").Enable = CBool(aryUserInfo(1,
6))
--
Cheers,
Ryan

--

Dave Peterson
.


--

Dave Peterson
.


--

Dave Peterson
.


--

Dave Peterson
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
Referencing command button on worksheet from VBA Ken Warthen[_2_] Excel Programming 3 May 5th 09 12:31 AM
How to create control button on worksheet: Forms v. ActiveX feature? [email protected] Excel Discussion (Misc queries) 2 February 16th 08 06:32 AM
Enable or Disable Forms Button on a worksheet from code Corey Excel Programming 1 November 5th 07 12:43 AM
Deactivating a Forms macro button based on a worksheet condition? Ace70 Excel Discussion (Misc queries) 3 June 10th 07 10:31 PM
Use of Forms Command-button on Worksheet Jim May Excel Discussion (Misc queries) 12 November 13th 06 06:08 PM


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

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

About Us

"It's about Microsoft Excel"