Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Referencing command button on worksheet from VBA

I have several command buttons on a worksheet in an Excel 2007 workbook. I
have a login form that hides/shows worksheets based on the login name of
either Administrator or User. If the login is User I also want to change the
visible property of some of the command buttons to false. I'm having trouble
figuring out how to reference the command buttons on the worksheet from the
VBA module of the login form. Any help or direction would be greatly
appreciated.

Ken
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Referencing command button on worksheet from VBA


Activesheet.Shapes("CommandButton1").Visible = false

where you replace CommandButton1 with the actual names. works whether they
came from the controls or the forms toolbar


"Ken Warthen" wrote:

I have several command buttons on a worksheet in an Excel 2007 workbook. I
have a login form that hides/shows worksheets based on the login name of
either Administrator or User. If the login is User I also want to change the
visible property of some of the command buttons to false. I'm having trouble
figuring out how to reference the command buttons on the worksheet from the
VBA module of the login form. Any help or direction would be greatly
appreciated.

Ken

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Referencing command button on worksheet from VBA

Might be worth adding - if you're not activating the sheets as you loop
through them, it seems you have to refer to them by name as opposed to using
their indexes.

"slarbie" wrote:


Activesheet.Shapes("CommandButton1").Visible = false

where you replace CommandButton1 with the actual names. works whether they
came from the controls or the forms toolbar


"Ken Warthen" wrote:

I have several command buttons on a worksheet in an Excel 2007 workbook. I
have a login form that hides/shows worksheets based on the login name of
either Administrator or User. If the login is User I also want to change the
visible property of some of the command buttons to false. I'm having trouble
figuring out how to reference the command buttons on the worksheet from the
VBA module of the login form. Any help or direction would be greatly
appreciated.

Ken

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Referencing command button on worksheet from VBA

Thanks for the help.

"slarbie" wrote:

Might be worth adding - if you're not activating the sheets as you loop
through them, it seems you have to refer to them by name as opposed to using
their indexes.

"slarbie" wrote:


Activesheet.Shapes("CommandButton1").Visible = false

where you replace CommandButton1 with the actual names. works whether they
came from the controls or the forms toolbar


"Ken Warthen" wrote:

I have several command buttons on a worksheet in an Excel 2007 workbook. I
have a login form that hides/shows worksheets based on the login name of
either Administrator or User. If the login is User I also want to change the
visible property of some of the command buttons to false. I'm having trouble
figuring out how to reference the command buttons on the worksheet from the
VBA module of the login form. Any help or direction would be greatly
appreciated.

Ken

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
set command button on a worksheet Bythsx-Addagio[_2_] Excel Programming 2 September 11th 08 01:10 PM
Command Button On A Worksheet Steve[_91_] Excel Programming 3 September 6th 07 09:18 AM
Command button on worksheet Dale Fye Excel Programming 4 August 22nd 07 03:00 PM
Command Button on worksheet Jack Excel Programming 4 June 12th 06 11:51 AM
command button on worksheet PhilC Excel Programming 1 May 19th 06 05:09 PM


All times are GMT +1. The time now is 01:11 PM.

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"