Jump to content

Help....


McDowell_Murthi

Recommended Posts

Dim rev As Revision
Dim rg As Range
Dim lastPg As Long
Dim pgList As String
Dim arrpages As Variant
Dim PagetoPrint As Long
Dim oDoc As Document
Dim i As Long
Set oDoc = ActiveDocument
For Each rev In oDoc.Revisions
    If Len(pgList) > 0 Then pgList = pgList & ","
        Set rg = rev.Range
        rg.Collapse wdCollapseStart
        If rev.Range.Information(wdActiveEndPageNumber) = _
                 rg.Information(wdActiveEndPageNumber) Then
        ' rev is contained on one page, so add that number to the list
        pgList = pgList & rev.Range.Information(wdActiveEndPageNumber)
    Else
        ' rev crosses at least one page boundary, so add page range to list
        pgList = pgList & rg.Information(wdActiveEndPageNumber) & "-" & _
                 rev.Range.Information(wdActiveEndPageNumber)
    End If
Next
arrpages = Split(pgList, ",")
pgList = ""
PagetoPrint = arrpages(LBound(arrpages))
pgList = PagetoPrint
For i = LBound(arrpages) + 1 To UBound(arrpages)
    If arrpages(i) <> PagetoPrint Then
        PagetoPrint = arrpages(i)
        pgList = pgList & "," & arrpages(i)
    End If
Next i

oDoc.PrintOut Range:=wdPrintRangeOfPages, Pages:=pgList

Link to comment
Share on other sites

Sub PrintTrackedChanges()

Dim revpagestart As Long, revpageend As Long, pageprint As String,
changedpages As String

pageprint = 0
changedpages = ""

Application.ScreenUpdating = False

currentselectionstart = Application.Selection.Start
currentselectionend = Application.Selection.End


With ActiveDocument
If .Revisions.Count = 0 Then MsgBox ("There are no revisions in this
document"): GoTo Finish
If .Revisions.Count 20 Then If MsgBox("There are" +
Str(.Revisions.Count) + " revisions in this document. Checking and
printing them may take some time. Continue?", vbYesNo) = vbNo Then
GoTo Finish

For i = 1 To .Revisions.Count
.Revisions(i).Range.Select
revpageend = Selection.Information(wdActiveEndPageNumber)
Selection.Collapse wdCollapseStart
revpagestart = Selection.Information(wdActiveEndPageNumber)

If .Revisions(i).Type = wdRevisionProperty Then GoTo Skip
If .Revisions(i).Type = wdRevisionParagraphProperty Then GoTo
Skip
If .Revisions(i).Type = wdRevisionSectionProperty Then GoTo
Skip

If pageprint = revpageend Then GoTo Skip

If revpagestart = revpageend Then
changedpages = changedpages + Str(revpageend) + ", "
pageprint = revpageend
End If

If revpageend revpagestart Then
changedpages = changedpages + Str(revpagestart) + "-" +
Str(revpageend) + ", "
pageprint = revpageend
End If
Skip:
Next i
End With

If changedpages = "" Then
MsgBox "There are no changed pages to print"
GoTo Finish
End If

changedpages = Left(changedpages, Len(changedpages) - 2)

With Dialogs(wdDialogFilePrint)
.Range = wdPrintRangeOfPages
.Pages = changedpages
.Show
End With

Finish:

Selection.SetRange Start:=currentselectionstart,
End:=currentselectionend
Application.ScreenUpdating = True

End Sub

 

Link to comment
Share on other sites

bro, ippudu aa code ke environment set chesi run cheyali ante kastam.. syntax error correct ga cheppi and aa line lo vasthundhi chepthey better

 

Link to comment
Share on other sites

3 hours ago, Biskot2 said:

bro, ippudu aa code ke environment set chesi run cheyali ante kastam.. syntax error correct ga cheppi and aa line lo vasthundhi chepthey better

 

Just word VBA lo copy cheste iypotundi environment em ledu..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...