Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Track Changes in MS Word

Status
Not open for further replies.

dprayner

Programmer
Oct 14, 2002
140
US
Hi People. I am trying to create a macro that would print only the pages in a document that contained changes. Basically I would need the program to recognize a change, select the whole page that it's on, and then print the selection. Are you aware of any commands that would recognize a change and select the page? Thanks, DAVE
 
When in the debug window (Ctrl+G) type nextrevision and press the F1 key to get a starting point.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
While using NextRevision is very useful, if the issue is simply printing pages with ANY revisions, it can be done simply. This is based on the ssumption that if a page has, say, four revisions, you are not going to print it four times. This checks to see if there are ANY revisions on the page, and if there is, it prints it.

NOTE: it prints WITH markup. This can, of course, be changed.

Code:
Sub PrintRevisedPages()
Dim oRange As Word.Range
Dim intPageCount As Integer
Dim msg As String
Dim var
intPageCount = ActiveDocument.Range.Information(wdNumberOfPagesInDocument)
Selection.HomeKey unit:=wdStory
On Error Resume Next
For var = 1 To intPageCount
  Set oRange = _
    ActiveDocument.Range _
     (Start:=ActiveDocument.Bookmarks("\page").Start, _
     End:=ActiveDocument.Bookmarks("\page").End - 1)
    If oRange.Revisions.Count > 0 Then
      Application.PrintOut FileName:="", _
        Range:=wdPrintCurrentPage, _
        Item:=wdPrintDocumentWithMarkup, _
        Copies:=1, Pages:=""
      Selection.GoToNext wdGoToPage
    Else
      Selection.GoToNext wdGoToPage
    End If
    Set oRange = Nothing
Next
End Sub

Gerry
 
Thank you guys. I think that's exactly what I am looking for. DAVE
 
You, of course, remove the Dim as msg line...I took this out of another routine.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top