Ignore strikethrough text in document character count 
Author Message
 Ignore strikethrough text in document character count

I would like to write a macro that counts every character in a
document but ignores any strikethrough text.  Does anyone have a
suggestion on how I would approach this?.....thanks for your help

-- Joel Swanson



Mon, 28 Mar 2005 12:26:39 GMT  
 Ignore strikethrough text in document character count
Hi Joel,

The most efficient way to do this is to delete the strikethrough text,
retrieve the character count, and then replace the strikethrough text.

MsgBox "Starting character count: " & _
    ActiveDocument.Characters.Count
With Selection
    .HomeKey unit:=wdStory
    With .Find
        .ClearFormatting
        .Font.StrikeThrough = True
        .Text = ""
        With .Replacement
            .ClearFormatting
            .Text = ""
        End With
        .Execute Replace:=wdReplaceAll
    End With
End With
MsgBox "Ending character count: " & _
    ActiveDocument.Characters.Count
' restore the strikethrough text
ActiveDocument.Undo

HTH


Quote:
> I would like to write a macro that counts every character in a
> document but ignores any strikethrough text.  Does anyone have a
> suggestion on how I would approach this?.....thanks for your help

> -- Joel Swanson



Mon, 28 Mar 2005 21:23:46 GMT  
 Ignore strikethrough text in document character count
Thanks Dave, I'll give it a try.


Tue, 29 Mar 2005 03:06:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Quote Character Ignored in Sorting Text

2. Scanning text & objDoc.Characters.Count

3. Counting number of characters in a text box

4. Counting Characters in a text box, and makeing a countdown timer

5. listview - How to strikethrough or strikeout text on individual rows

6. Ignore punctuation when counting words

7. Ignoring Characters.

8. RegExp ignores ASCII characters btwn 130 and 159

9. Ignoring/escaping special characters in SQL

10. text compare character by character

11. running character count

12. Counting characters as they are typed

 

 
Powered by phpBB® Forum Software