1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VB help creating a toggle button

Discussion in 'Business Applications' started by pickwick, Nov 4, 2007.

Thread Status:
Not open for further replies.
  1. pickwick

    pickwick Thread Starter

    Oct 31, 2007
    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!
  2. Zack Barresse

    Zack Barresse

    Jul 25, 2004
    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. ;) ...

    commandbars("Tables").visible = not commandbars("Visible").visible
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/647841

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice