Microsoft KB Archive/106190

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 10:09, 20 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WD: WordBasic Examples: AppWindowHeight/Width/PosLeft/PosTop

Q106190



The information in this article applies to:


  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows, version 7.0





SUMMARY

This article contains an example that demonstrates the use of the following WordBasic statements or functions:

AppWindowHeight AppWindowHeight()


AppWindowPosLeft AppWindowPosLeft()

AppWindowPosTop AppWindowPosTop()

AppWindowWidth AppWindowWidth()

Note: On the Macintosh, these commands are not available and will generate errors.

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



MORE INFORMATION

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

AppWindowHeight, AppWindowHeight()

Syntax:

   AppWindowHeight [WindowName$,] Height
   AppWindowHeight([WindowName$]) 

Example:

The AppWindowHeight statement adjusts the height of an application window to a specified number of points (if WindowName$ is omitted, Word is assumed). AppWindowHeight allows you to change the height of a window without affecting its width (unlike AppSize). The AppWindowHeight() function returns the height of an application window in points. For argument descriptions, see AppSize.

   Sub MAIN
      x = 0
      state = AppMaximize()
      If state = - 1 Then AppRestore
      x = AppWindowHeight()
      MsgBox "The height of this window is: " + Str$(x)
      AppWindowHeight x - 100
      MsgBox "The height of this window is: " + Str$(x - 100)
   End Sub 

AppWindowPosLeft, AppWindowPosLeft()

Syntax:

   AppWindowPosLeft [WindowName$,] HorizPos
   AppWindowPosLeft([WindowName$]) 

Example:

The AppWindowPosLeft statement moves an application window or icon to a horizontal position specified in points (if WindowName$ is omitted, Word is assumed). AppWindowPosLeft allows you to change the horizontal position of a window or icon without affecting its vertical position (unlike AppMove). The AppWindowPosLeft() function returns the horizontal position of an application window or icon, in points. For argument descriptions, see AppMove.

   Sub MAIN
      state = AppMaximize()
      If state = - 1 Then AppRestore
      x = AppWindowPosLeft()
      MsgBox "The distance from the left is: " + Str$(x)
      AppWindowPosLeft x + 100
      MsgBox "The distance from the left is: " + Str$(x +100)
   End Sub 

AppWindowPosTop, AppWindowPosTop()

Syntax:

   AppWindowPosTop [WindowName$,] VertPos
   AppWindowPosTop([WindowName$]) 

Example:

The AppWindowPosTop statement moves an application window or icon to a vertical position specified in points (if WindowName$ is omitted, Word is assumed). AppWindowPosTop allows you to change the vertical position of a window or icon without affecting its horizontal position (unlike AppMove). The AppWindowPosTop() function returns the vertical position of an application window or icon, in points. For argument descriptions, see AppMove.

   Sub MAIN
      x = 0
      state = AppMaximize()
      If state = - 1 Then AppRestore
      x = AppWindowPosTop()
      MsgBox "The distance from the top is: " + Str$(x)
      AppWindowPosTop x + 100
      MsgBox "The distance from the top is: " + Str$(x + 100)
   End Sub 

AppWindowWidth, AppWindowWidth()

Syntax:

   AppWindowWidth [WindowName$,] Width
   AppWindowWidth([WindowName$]) 

Example:

The AppWindowWidth statement adjusts the width of an application window to a specified number of points (if WindowName$ is omitted, Word is assumed). AppWindowWidth allows you to change the width of a window without affecting its height (unlike AppSize). The AppWindowWidth() function returns the width of an application window, in points. For argument descriptions, see AppSize.

   Sub MAIN
      x = 0
      state = AppMaximize()
      If state = - 1 Then AppRestore
      x = AppWindowWidth()
      MsgBox "The width of this window is: " + Str$(x)
      AppWindowWidth x / 2
      MsgBox "The width of this window is: " + Str$(x / 2)
   End Sub 

Additional query words:

Keywords : wordnt kbmacroexample ntword word6 word7 word95
Issue type : kbinfo
Technology :


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