McDowell_Murthi Posted October 1, 2019 Report Posted October 1, 2019 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 Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 Can someone help me fix this code please? Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 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 Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 Ee rendu run cheste naku errors vastunnayi.. meeku vastunnaya? If yes can someone fix them? Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 naku ekkuva coding radu.. online lo search cheste i found this but naku run cheste errors vastunnay Quote
Biskot2 Posted October 1, 2019 Report Posted October 1, 2019 bro, ippudu aa code ke environment set chesi run cheyali ante kastam.. syntax error correct ga cheppi and aa line lo vasthundhi chepthey better Quote
Hitman Posted October 1, 2019 Report Posted October 1, 2019 ఇంతకీ ఏ language అది.. టైటిల్ లో add చేస్తే you will get faster help Quote
mmharshaa Posted October 1, 2019 Report Posted October 1, 2019 10 minutes ago, Hitman said: ఇంతకీ ఏ language అది.. టైటిల్ లో add చేస్తే you will get faster help vba Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 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.. Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 syntax error ani 1st line lo vachindi Quote
McDowell_Murthi Posted October 1, 2019 Author Report Posted October 1, 2019 VBA experts unte vachi help cheyandi... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.