WD: WordBasic Examples: ViewToolbars

Last reviewed: November 17, 1997
Article ID: Q109760
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, version 7.0
  • Word for the Macintosh, versions 6.0, 6.0.1

SUMMARY

This article contains a sample macro that demonstrates the use of the following WordBasic statements and functions:

   ViewToolbars
   ViewBorderToolbar
   ViewDrawingToolbar

This article supplements the information in online Help. To open this Help topic, click Contents on the Help menu and then click the "Programming with Microsoft Word" topic.

MORE INFORMATION

ViewToolbars

Syntax:

ViewToolbars [.Toolbar = text] [, .Context = number] [, .ColorButtons = number] [, .LargeButtons = number] [, .ToolTips = number] [, .Reset] [, .Delete] [, .Show] [, .Hide]

Example:

The following sample macro prompts the user for a toolbar to view. After the toolbar is displayed, the macro asks the user if the toolbar should then be hidden. Run the macro and type "Microsoft" (without the quotation marks).

 Sub MAIN
  On Error Goto done
  name$ = InputBox$("What is the name of the toolbar you would \
   like displayed?")
  ViewToolbars .Toolbar = name$, .Show
  n = MsgBox("Would you like to hide the " + name$ + " toolbar?", 35)
  Select Case n
   Case - 1
    ViewToolbars .Toolbar = name$, .Hide
   Case Else
  End Select
  done:
 End Sub

There are two additional commands that can also be used to display and hide certain toolbars:
  • ViewBorderToolbar
  • ViewDrawingToolbar

ViewBorderToolbar

Example:

 Sub Main
  MsgBox "Choose OK to toggle the Border Toolbar on or off."
  ViewBorderToolbar
 End Sub

ViewDrawingToolbar

Example:

 Sub Main
  MsgBox "Choose OK to toggle the Drawing Toolbar on or off."
  ViewDrawingToolbar
 End Sub

Both of the previous macros display the toolbar if the toolbar is hidden and hide the toolbar if it is displayed.


Additional query words:
Keywords : kbmacroexample macword winword word6 word7 word95 kbcode kbmacro kbprg
Version : WINDOWS:6.0,6.0a,6.0c,7.0; MACINTOSH:6.0,6.0.1
Platform : MACINTOSH WINDOWS
Issue type : kbhowto kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.