Hide/show and enable/disable buttons 
Author Message
 Hide/show and enable/disable buttons

Depending an If-Statement I want to hide or show a certain button on a
custom toolbar. Another If-Statement has to enable or disable another button
on a custom toolbar (as Word does to indicate that an option is invalid).

Could someone please help with the VBA code.

Thanks!



Fri, 13 Feb 2004 23:01:18 GMT  
 Hide/show and enable/disable buttons
Hi Alexander,

Quote:
> Depending an If-Statement I want to hide or show a certain button on a
> custom toolbar. Another If-Statement has to enable or disable another
button
> on a custom toolbar (as Word does to indicate that an option is invalid).

Dim myButton As CommandBarButton
Set myButton = CommandBars("Custom 1").Controls(1)

myButton.Enabled = False

myButton.Visible = False

--
Hope this helps.
ibby

Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.



Fri, 13 Feb 2004 23:46:38 GMT  
 Hide/show and enable/disable buttons
Thanks for the example code. It helped me a lot.

The condition I planned to link the code to was a number of open documents
of 0. My custom toolbar is in a seperate template, no new documents are
based on this template, only toolbars. How can I trigger the event 'Open'
and 'Close' to redetermine the number of open documents, without using the
standard template to place the code in. The custom template is updated
automatically to selected users with updates of the toolbar. A regular
update of the users standard template is not preverable because this would
override eventual individual settings in their standard template.

Thanks!

Quote:

>Hi Alexander,

>> Depending an If-Statement I want to hide or show a certain button on a
>> custom toolbar. Another If-Statement has to enable or disable another
>button
>> on a custom toolbar (as Word does to indicate that an option is invalid).

>Dim myButton As CommandBarButton
>Set myButton = CommandBars("Custom 1").Controls(1)

>myButton.Enabled = False

>myButton.Visible = False

>--
>Hope this helps.
>ibby

>Please post replies or follow-ups to the **newsgroup** so that participants
>may benefit or contribute.



Sun, 22 Feb 2004 23:40:06 GMT  
 Hide/show and enable/disable buttons
Alexander,

Quote:
> The condition I planned to link the code to was a number of open documents
> of 0. My custom toolbar is in a seperate template, no new documents are
> based on this template, only toolbars. How can I trigger the event 'Open'
> and 'Close' to redetermine the number of open documents, without using the
> standard template to place the code in. The custom template is updated
> automatically to selected users with updates of the toolbar. A regular
> update of the users standard template is not preverable because this would
> override eventual individual settings in their standard template.

Take a look at the following article:

http://www.mvps.org/word/FAQs/MacrosVBA/PseudoAutoMacros.htm

--
Hope this helps.
ibby

Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.



Mon, 23 Feb 2004 00:09:30 GMT  
 Hide/show and enable/disable buttons
This seemed to have worked. Thanks for your help Ibby.
Quote:
>Take a look at the following article:

>http://www.mvps.org/word/FAQs/MacrosVBA/PseudoAutoMacros.htm

>--
>Hope this helps.
>ibby

>Please post replies or follow-ups to the **newsgroup** so that participants
>may benefit or contribute.



Mon, 23 Feb 2004 00:55:39 GMT  
 Hide/show and enable/disable buttons
The solution you provided me with works wonderfully for me. However, when
the buttons are enabled or disabled depending the conditions in the code,
Word registers the alteration of the toolbar and is prompting the user to
save the changes (when closing Word). How can I suppress this, since this
would mean users have to reply after every session.

Quote:

>This seemed to have worked. Thanks for your help Ibby.

>>Take a look at the following article:

>>http://www.mvps.org/word/FAQs/MacrosVBA/PseudoAutoMacros.htm

>>--
>>Hope this helps.
>>ibby

>>Please post replies or follow-ups to the **newsgroup** so that
participants
>>may benefit or contribute.



Tue, 24 Feb 2004 22:58:34 GMT  
 Hide/show and enable/disable buttons
Hi Alexander

Use:
ThisDocument.Saved = True immediately after modifying the buttons.

Regards

Dave


| The solution you provided me with works wonderfully for me. However, when
| the buttons are enabled or disabled depending the conditions in the code,
| Word registers the alteration of the toolbar and is prompting the user to
| save the changes (when closing Word). How can I suppress this, since this
| would mean users have to reply after every session.
|
|
|
| >This seemed to have worked. Thanks for your help Ibby.
| >
| >
| >>Take a look at the following article:
| >>
| >>http://www.mvps.org/word/FAQs/MacrosVBA/PseudoAutoMacros.htm
| >>
| >>
| >>--
| >>Hope this helps.
| >>ibby
| >>
| >>Please post replies or follow-ups to the **newsgroup** so that
| participants
| >>may benefit or contribute.
|
|
|



Wed, 25 Feb 2004 00:13:31 GMT  
 Hide/show and enable/disable buttons
This works. Thanks.
Quote:

>Hi Alexander

>Use:
>ThisDocument.Saved = True immediately after modifying the buttons.

>Regards

>Dave



>| The solution you provided me with works wonderfully for me. However, when
>| the buttons are enabled or disabled depending the conditions in the code,
>| Word registers the alteration of the toolbar and is prompting the user to
>| save the changes (when closing Word). How can I suppress this, since this
>| would mean users have to reply after every session.
>|
>|
>|

>| >This seemed to have worked. Thanks for your help Ibby.
>| >
>| >
>| >>Take a look at the following article:
>| >>
>| >>http://www.mvps.org/word/FAQs/MacrosVBA/PseudoAutoMacros.htm
>| >>
>| >>
>| >>--
>| >>Hope this helps.
>| >>ibby
>| >>
>| >>Please post replies or follow-ups to the **newsgroup** so that
>| participants
>| >>may benefit or contribute.
>|
>|
>|



Fri, 27 Feb 2004 15:33:23 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Buttons: Disabling & Enabling INPUT Button

2. Enable/ Disable Show Pictures

3. Disable / Enable a Command Button Code

4. disable/enable toolbar button at runtime?

5. Toolbar Buttons - enable/disable

6. enabling and disabling a command button

7. Disable/Enable Buttons...

8. Enabling/Disabling button based on Listview selection

9. Enable / Disable Button Using Toolbar Control

10. Disable or hide buttons on custom toolbar?

11. How hide menuitens like tools options or disable com-add ins button

12. Reversing Actions with VBA, ie show and hide with the same button

 

 
Powered by phpBB® Forum Software