Selection object macros only work on last selection in Word (281864)



The information in this article applies to:

  • Microsoft Office Word 2003
  • Microsoft Word 2002

This article was previously published under Q281864

SYMPTOMS

When you run a Microsoft Visual Basic for Applications macro that uses selection objects and inserts text in a document that contains a non-contiguous selection, only the last selection is affected by the macro.

CAUSE

This behavior occurs when you have multiple selections and run a macro that contains selection objects. Microsoft Office Word allows only one selection object to be active at a time. Thus, when you use multiple selections, the macro only affects the last selection.

WORKAROUND

To work around this behavior, do not use multiple selections when you run a macro that contains selection objects. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

288424 Limited programmatic access to Word 2002 discontiguous selections

REFERENCES

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

275969 Cannot select non-contiguous text with keyboard


Modification Type:MajorLast Reviewed:9/25/2006
Keywords:kbprb KB281864