VB help creating a toggle button

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

pickwick

Thread Starter
Joined
Oct 31, 2007
Messages
7
I'm just starting to get my head around some basic VB programming for writing macros in word... and I need help already! Can anyone tell me how best to create a toggle button macro? I want to be able to show/hide a toolbar that I've created called 'Tables'.

so far all I can work out is to open and then close the toolbar
CommandBars ("Tables").Visible = True
CommandBars ("Tables").Visible = False
but I want to be able to do it with a single button, not two.

I know it's basic, but ya gotta start somewhere!
 
Joined
Jul 25, 2004
Messages
5,458
Hi there, welcome to the board!

Just check it's state. You can check the visible property as well as set it. You can also toggle it to the opposite state as it is a boolean (true/false) setting. Take a look at the following. ;) ...

Code:
commandbars("Tables").visible = not commandbars("Visible").visible
HTH
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top