WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
290140
How to run the sample code for the Office XP programs from Knowledge Base articles
To work around this behavior, set the
ShowAll property for the range to True before you get the
Text property of a range. In both normal view and print layout view, the property contains the same text, including the tracked changes of deleted text.
For example, the following macro runs correctly in both normal view and print layout view, because the
ShowAll property is set to True:
Sub A()
Dim RNG As Range
Selection.SetRange 0,10
'Select the first 10 characters.
Set RNG = Selection.Range.Duplicate
'Set the range to be a duplicate of the current selection.
RNG.ShowAll = True
'Use all the text in the selected range, including tracked changes.
MsgBox Len(RNG.Text)
End Sub