WD: WordBasic Examples: ViewZoom Commands

Last reviewed: February 2, 1998
Article ID: Q109767
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows NT, version 6.0
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • 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:

   ViewZoom
   ViewZoom100
   ViewZoom200
   ViewZoom75
   ViewZoomPageWidth
   ViewZoomWholePage

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

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

ViewZoom

Syntax:

ViewZoom [.AutoFit] [, .TwoPages] [, .FullPage] [, .NumColumns - number] [, .NumRows - number] [, .ZoomPercent - text]

ViewZoom changes the magnification for the active document and new documents in the current view. The arguments for ViewZoom correspond to the options in the Zoom dialog box (View menu).

ViewZoom75

Syntax:

ViewZoom75

ViewZoom75 switches to normal view and sets magnification to 75 percent for the active document and new documents.

ViewZoom100

Syntax:

ViewZoom100

ViewZoom100 switches to normal view and sets magnification to 100 percent for the active document and new documents.

ViewZoom200

Syntax:

ViewZoom200

ViewZoom200 switches to normal view and sets magnification to 200 percent for the active document and new documents.

ViewZoomPageWidth

Syntax:

ViewZoomPageWidth

ViewZoomPageWidth sets magnification so the entire width of the page is visible.

ViewZoomWholePage

Syntax:

ViewZoomWholePage

ViewZoomWholePage sets magnification so the entire page is visible in page layout view. ViewZoomWholePage switches to page layout view if the active document is in another view.

Example:

The following sample macro allows you to select among several options for the ViewZoom command:

   Sub MAIN
      Begin Dialog UserDialog 376, 227, "Microsoft Word"
         Text 10, 6, 355, 13, "Choose an option for the ViewZoom command",\
         .Text1
         OKButton 11, 200, 171, 21
         CancelButton 195, 200, 169, 21
         OptionGroup  .OptionGroup1
            OptionButton 12, 22, 79, 16, "Autofit", .OptionButton1
            OptionButton 12, 39, 113, 16, "Two Pages", .OptionButton2
            OptionButton 12, 56, 100, 16, "Full Page", .OptionButton3
            OptionButton 12, 73, 208, 16, "Set Number Of Columns", \
            .OptionButton4
            OptionButton 12, 90, 184, 16, "Set Number of Rows", \
            .OptionButton5
            OptionButton 12, 107, 157, 16, "Set Zoom to 75%", \
            .OptionButton6
            OptionButton 12, 124, 167, 16, "Set Zoom to 100%", \
            .OptionButton7
            OptionButton 12, 141, 167, 16, "Set Zoom to 200%", \
            .OptionButton8
            OptionButton 12, 158, 192, 16, "Zooms to Page Width", \
            .OptionButton9
            OptionButton 12, 175, 201, 16, "Zooms To Whole Page", \
            .OptionButton10
      End Dialog
      Dim dlg As UserDialog
      n - Dialog(dlg)
      If n - 0 Then Goto Bye
      Select Case dlg.OptionGroup1
         Case 0
            ViewZoom .AutoFit
         Case 1
            ViewPage
            ViewZoom .TwoPages
         Case 2
            ViewPage
            ViewZoom .FullPage
         Case 3
            ViewPage
            num - Val(InputBox$("How many pages across do you want to \
            display"))
            ViewZoom .NumColumns - num
         Case 4
            ViewPage
            num - Val(InputBox$("How many pages down do you want to \
            display"))
            ViewZoom .NumRows - num
         Case 5
            ViewZoom75
         Case 6
            ViewZoom100
         Case 7
            ViewZoom200
         Case 8
            ViewZoomPageWidth
         Case 9
            ViewZoomWholePage
      End Select
   Bye:
   End Sub


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


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: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.