Microsoft KB Archive/107534

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.

All Caps Formatting Retained by Selection$() Function

Article ID: Q107534
Creation Date: 23-NOV-1993
Revision Date: 10-SEP-1996 The information in this article applies to:

  • Microsoft Word for Windows, version 6.0, 6.0a
  • Microsoft Word for the Macintosh, version 6.0

SYMPTOMS


The WordBasic Selection$() function returns the plain, unformatted text of the current selection. However, if the selection contains text formatted as All Caps, Selection$() will return the text leaving the All Caps formatting intact.

The expected behavior would be for the All Caps formatting, applied from the Format Font dialog box, to be removed from the selection when Selection$() is assigned to a string variable.

Note: Selection$() correctly returns unformatted text when the selection is formatted for other formats including Small Caps.

STATUS


Although the expected behavior would be to remove the formatting and show only the unformatted text, the response from the Selection$() command is by design.

WORKAROUND


To remove the All Caps formatting, you can use the ResetChar statement before the Selection$() function and then EditUndo the ResetChar statement to return the document to the previous formatting.

For example:

Sub MAIN ResetChar a$ = Selection$() EditUndo End Sub

Kbcategory: kbusage kbmacro KBSubcategory:



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.

©1997 Microsoft Corporation. All rights reserved. Legal Notices.


Additional reference words: 6.00 selection formatting winword macword
word6 unformatted text