WD: WordBasic Examples: Toggle Commands

Last reviewed: November 17, 1997
Article ID: Q106334
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 or functions:

   ToggleFull

   ToggleMainTextLayer

   TogglePortrait

This article supplements the information in online Help. To open this Help topic in Word for Windows, click Contents on the Help menu and then choose the "Programming with Microsoft Word" topic. In Word for the Macintosh, click the Help icon, select Microsoft Word Help and choose the "Programming with Microsoft Word" topic.

MORE INFORMATION

ToggleFull

Syntax:

ToggleFull

Example:

This sample macro allows you to see a document on screen without rulers, toolbars, or other screen elements.

   Sub MAIN
      If SelInfo(27) = - 1 Then FileNewDefault
      MsgBox "Press OK to Toggle Full Screen"
      ToggleFull
      MsgBox "Press OK to Toggle Back"
      ToggleFull
   End Sub

ToggleMainTextLayer

Syntax:

ToggleMainTextLayer

Example:

This sample macro toggles the display of the text in the document layer when headers and footers are displayed. If the selection is not within a header or footer, an error occurs.

   Sub MAIN
      If SelInfo(27) = - 1 Then FileNewDefault
      Insert "This text is visible on the main text layer"
      ViewHeader
      MsgBox "Press OK to switch to the main text layer"
      ToggleMainTextLayer
   End Sub

TogglePortrait

Syntax

TogglePortrait

Example

This sample macro switches the selected sections between portrait and landscape page orientations. If the selected sections have different page orientations, an error occurs.

   Sub MAIN
      If SelInfo(27) = - 1 Then FileNewDefault
      ViewPage
      ViewZoom .FullPage
      TogglePortrait
      For Count = 1 To 300
      '...Pause
      Next count
      TogglePortrait
    End Sub


Additional query words:
Keywords : kbmacroexample macword winword word6 word7 word95 kbcode kbmacro kbprg
Version : MACINTOSH:6.0,6.0.1,6.0.1a;WINDOWS: 6.0a,6.0c,7.0,7.0a
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.