Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Forms Toolbar Button question


I have a button on my worksheet created from the forms toolbar.

How do I access the button through VBA?

sheets(1).Item???

Also I would just like to make it invisible and/or disable it.
Which property would I use?

Thanks


--
reddog9069
------------------------------------------------------------------------
reddog9069's Profile: http://www.excelforum.com/member.php...o&userid=24458
View this thread: http://www.excelforum.com/showthread...hreadid=388898

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Forms Toolbar Button question


the button you have created is a Shape and can be referenced as such.
(see Excel Help for Shapes collection to find the available properties.
(your code is in general :

Sheet(1).Shapes("button1").

i.e. to set as 'not visible'

ActiveSheet.Shapes("Button 1").Visible = False

not sure that you can disable these shapes but you could handle this
requirement in the macro that is called via the 'OnAction' property

You could also create a button from the Control Toolbox toolbar; in
this case you would have all of the functionality but with the benefits
of being able to directly access the properties associated with a contol
rather than the slightly more complex code associated with a shape.
These Controls are also locked when not in Design Mode so that you can
prevent user changes (to formatting etc). these Controls do have an
Enabled property that can be set to false.

find the Controls Toolbox by displaying the Visual Basic Toolbar and
click on the Control Toolbox button (or other routes...).

Control Buttons on worksheets can be seen as a bit of a hammer to crack
a nut but the access to properties and events is generally useful.
Rather than assigning a macro to run when the button is clicked
{onAction}, right-click on the button in Design Mode and select Code
from the menu; this displays the default event ( _Click) - place your
code here; or call another routine using the Call statement ...

Have fun.


--
optionbase1
------------------------------------------------------------------------
optionbase1's Profile: http://www.excelforum.com/member.php...o&userid=25212
View this thread: http://www.excelforum.com/showthread...hreadid=388898

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Forms Toolbar Button question

One way:

To access the button:

Sheets(1).Buttons("myButton").Caption = "My Caption"

Invisible:

Sheets(1).Buttons("myButton").Visible = False

Disabled:

Sheets(1).Buttons("myButton").Enabled = False


In article ,
reddog9069
wrote:

I have a button on my worksheet created from the forms toolbar.

How do I access the button through VBA?

sheets(1).Item???

Also I would just like to make it invisible and/or disable it.
Which property would I use?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Forms Toolbar Button question


Thanks for all your help

--
reddog906
-----------------------------------------------------------------------
reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445
View this thread: http://www.excelforum.com/showthread.php?threadid=38889

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Forms Toolbar Button question


thanks for that (JE McGimpsey); I didn't know that object existed & when
I search for the object in Help it shows :

"Hidden Language Element
You have requested Help for a language element that is hidden, and
therefore unavailable for programmatic access. "

any idea why?

Are there other objects that are 'hidden' in this way and if so how do
I access information on them and their properties / methods / events?

Thanks for the help anyway! :)


--
optionbase1
------------------------------------------------------------------------
optionbase1's Profile: http://www.excelforum.com/member.php...o&userid=25212
View this thread: http://www.excelforum.com/showthread...hreadid=388898

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
Insert comments on Option Button of Forms Toolbar Rechie Excel Discussion (Misc queries) 2 March 14th 10 11:26 AM
Can i use the button in forms toolbar and maneuver to differentt.. Denny Crane Excel Worksheet Functions 4 March 15th 06 08:45 PM
Option Button on Forms Toolbar admannj Excel Discussion (Misc queries) 4 January 25th 05 01:07 AM
button control on Forms toolbar Greg Goralski Excel Programming 2 July 22nd 04 03:11 PM
Option Button Macro (Forms Toolbar) AG[_5_] Excel Programming 3 July 16th 04 02:05 AM


All times are GMT +1. The time now is 09:36 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"