Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default How to disable a button picked from the Forms list.

Hi,
I have a button on one of my worksheets picked from the Forms list
this control don't have an Enabled property so I would like to know
if it is possible to use VBA to disable it.

I can use the other Activex command button picked from
the control toolbox but that is causing problem with Excel 2000.

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to disable a button picked from the Forms list.

Ben,

How about hiding it completely

activesheet.buttons("Button 1").Visible = False

What problems are you having with ActiveX buttons? I have heard of problems
with 2003, but not 2000.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ben" wrote in message
...
Hi,
I have a button on one of my worksheets picked from the Forms list
this control don't have an Enabled property so I would like to know
if it is possible to use VBA to disable it.

I can use the other Activex command button picked from
the control toolbox but that is causing problem with Excel 2000.

Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default How to disable a button picked from the Forms list.

Forms buttons can be disabled but this will only disable the click
functionality. So the appended macros disable and enable the button including
graying of font.

Sub DisableBtn()
With ActiveSheet.Buttons(1)
.Enabled = False
.Font.Color = RGB(140, 140, 140)
End With
End Sub

Sub EnableBtn()
With ActiveSheet.Buttons(1)
.Enabled = True
.Font.Color = vbBlack
End With
End Sub

Regards,
Greg


"Ben" wrote:

Hi,
I have a button on one of my worksheets picked from the Forms list
this control don't have an Enabled property so I would like to know
if it is possible to use VBA to disable it.

I can use the other Activex command button picked from
the control toolbox but that is causing problem with Excel 2000.

Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default How to disable a button picked from the Forms list.

Hi Bob and Greg,

Greg, thanks it worked.

Bob, when you use Activex Buttons on worksheets and you don't
want to save the file when the macro is enable and click on the X
to close the file it always ask you if you want to save the file even
if you put in the Workbook_BeforeClose event code like this
ThisWorkbook.Saved = True

"Greg Wilson" wrote:

Forms buttons can be disabled but this will only disable the click
functionality. So the appended macros disable and enable the button including
graying of font.

Sub DisableBtn()
With ActiveSheet.Buttons(1)
.Enabled = False
.Font.Color = RGB(140, 140, 140)
End With
End Sub

Sub EnableBtn()
With ActiveSheet.Buttons(1)
.Enabled = True
.Font.Color = vbBlack
End With
End Sub

Regards,
Greg


"Ben" wrote:

Hi,
I have a button on one of my worksheets picked from the Forms list
this control don't have an Enabled property so I would like to know
if it is possible to use VBA to disable it.

I can use the other Activex command button picked from
the control toolbox but that is causing problem with Excel 2000.

Thank you.

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
Setting up a list where an item can only be picked once in Excel J. Excel Worksheet Functions 2 May 17th 07 01:17 AM
How validation dropdown list open when cell is picked?. ron Excel Worksheet Functions 1 February 22nd 06 12:44 AM
how disable a button forms .. milly Excel Programming 1 August 1st 05 11:34 AM
Disable Close "X" button on User Forms Celtic_Avenger[_50_] Excel Programming 0 October 11th 04 06:25 PM
Disable Close "X" button on User Forms Celtic_Avenger[_49_] Excel Programming 2 October 11th 04 06:20 PM


All times are GMT +1. The time now is 03:31 PM.

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"