Microsoft KB Archive/109767

From BetaArchive Wiki

WD: WordBasic Examples: ViewZoom Commands

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
  • Microsoft 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 professionals 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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please see the following page on the World Wide Web:

http://www.microsoft.com/partner/referral/

For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://support.microsoft.com/directory/overview.asp

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 : kbmacro kbprg kbdtacode wordnt kbmacroexample winword ntword macword word6 word7 word95
Issue type : kbhowto
Technology : kbWordSearch kbWordWSearch kbWordMSearch


Last Reviewed: December 29, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.