Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-14-2015, 10:09 AM
gloos gloos is offline Select the whole sentence when a word has been modified Windows XP Select the whole sentence when a word has been modified Office 2007
Novice
Select the whole sentence when a word has been modified
 
Join Date: Apr 2015
Posts: 1
gloos is on a distinguished road
Default Select the whole sentence when a word has been modified


Hello,

I currently use the macro below to give me the number of added words when looking at a document with track changes. I would also like to return the number of words in this sentence. How can I do that? Thank you!

HTML Code:
Sub GetTCStats()
Dim lInsertsWords As Long
Dim lInsertsChar As Long
Dim lDeletesWords As Long
Dim lDeletesChar As Long
Dim sTemp As String
Dim oRevision As Revision
lInsertsWords = 0
lInsertsChar = 0
lDeletesWords = 0
lDeletesChar = 0
For Each oRevision In ActiveDocument.Revisions
Select Case oRevision.Type
Case wdRevisionInsert
lInsertsChar = lInsertsChar + Len(oRevision.Range.Text)
lInsertsWords = lInsertsWords + oRevision.Range.Words.Count
Case wdRevisionDelete
lDeletesChar = lDeletesChar + Len(oRevision.Range.Text)
lDeletesWords = lDeletesWords + oRevision.Range.Words.Count
End Select
Next oRevision
sTemp = "Insertions" & vbCrLf
sTemp = sTemp & " Words: " & lInsertsWords & vbCrLf
sTemp = sTemp & " Characters: " & lInsertsChar & vbCrLf
sTemp = sTemp & "Deletions" & vbCrLf
sTemp = sTemp & " Words: " & lDeletesWords & vbCrLf
sTemp = sTemp & " Characters: " & lDeletesChar & vbCrLf
MsgBox sTemp
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Select the whole sentence when a word has been modified Delete does not bring second sentence closer to first sentence Andoheb Word 29 07-03-2014 01:48 PM
Select the whole sentence when a word has been modified First word of sentence IF and then awolf Word VBA 7 03-16-2014 02:40 PM
Append text to a sentence containing specific word dgp Word VBA 3 02-28-2014 10:38 PM
Modified Signature Line in Microsoft Word gurp99 Word 0 03-28-2012 09:58 AM
I want to lock a sentence in Word smorkette Word 1 02-06-2010 12:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:12 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft