Microsoft KB Archive/103707

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Microsoft Knowledge Base

Excel: Using GET.WORKSPACE() to Determine Screen Element Size

Last reviewed: September 12, 1996
Article ID: Q103707

The information in this article applies to:

  • Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0
  • Microsoft Excel for the Macintosh, versions 3.0, 4.0

SUMMARY

When you develop a custom application in Microsoft Excel that will run on machines with different screen resolutions, it may be useful to determine the amount of space that different workspace elements such as the menu bar, formula bar, status bar and/or toolbar will use. After determining the amount of space these elements use, you can then determine how and where to position documents and which of these elements you want to be displayed.

Use the GET.WORKSPACE() macro command to determine the element size. This command takes a type_num argument which specifies the type of workspace information you want; specifying a type_num of 13 returns the usable workspace width and 14 returns the usable workspace height. You can determine the the size of an individual workspace element with GET.WORKSPACE(13) or GET.WORKSPACE(14) before and after you remove the element from the workspace. (Note: this is true for version 5.0 macro sheets, but not modules.)

Example

For example, if you want to determine the height of the status bar, use GET.WORKSPACE(14) before and after disabling the status bar with the WORKSPACE() macro command.

The following macro will return the height of the status bar and display it in an alert box.

A1: Status_Height A2: =WORKSPACE(,,,,FALSE) A3: nostatusbar=GET.WORKSPACE(14) A4: =workspace(,,,,TRUE) A5: statusbar=GET.WORKSPACE(14) A6: statusbarheight=nostatusbar-statusbar A7: =ALERT("The height of the status bar in points is "&statusbarheight) A7: =RETURN()

Microsoft provides macro 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.

REFERENCES

"Function Reference," version 4.0, pages 209-212, 465-466


KBCategory: kbusage

KBSubcategory:

Additional reference words: 4.00a 4.00 3.00



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: September 12, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.