Help and Support
 

powered byLive Search

The formatting of text is reset to plain text when you try to determine character formatting programmatically in Word 2007

Article ID:925183
Last Review:October 15, 2007
Revision:1.2

SYMPTOMS

You try to determine programmatically whether the text at the cursor uses bold, italic, or underline character formatting in Microsoft Office Word 2007. When you do this, the type of character formatting is correctly identified.

However, after the formatting is determined programmatically, the formatting of the text that was tested is reset to plain text formatting. Additionally, the Bold, the Italic, or the Underline button in the Font group on the Home tab is no longer selected.

You might try again to determine programmatically what the character formatting is for the same text. When you do this, the formatting is again identified as the original formatting (bold, italic, or underlined). However, the current formatting is plain text.

Back to the top

CAUSE

This issue occurs when the code that is used to determine the type of character formatting uses the Range property of the Selection object. When you use the Range property to determine the type of character formatting of a range of text, the character formatting for that text is reset to plain text when the code finishes running.

Back to the top

WORKAROUND

To work around this issue, set the DontResetInsertionPointProperties application property to "true" only when you use the Range property to determine the type of character formatting for a range of text. Do not use this property globally within your code. The DontResetInsertionPointProperties property should be used only in direct conjunction with the Range property.

An example of this code is as follows:
   Application.DontResetInsertionPointProperties = True

' Format testing code segment

   Application.DontResetInsertionPointProperties = False

Back to the top


APPLIES TO
Microsoft Office Word 2007

Back to the top

Keywords: 
kbtshoot kbregistry kbformat kbprogramming kbprb kbcode kbexpertiseinter KB925183

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.