Thread: [Solved] Macro for printing
View Single Post
 
Old 09-10-2020, 03:55 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Bookmark the location where you want the changed text with the bookmark name "CopyNum" Then run the following macro


Code:
Sub PrintTriplicate()
'Graham Mayor - https://www.gmayor.com - Last updated - 10 Sep 2020
Dim oRng As Range
Dim Counter As Long
    If ActiveDocument.Bookmarks.Exists("CopyNum") = False Then
        MsgBox "The bookmark 'CopyNum' is missing from the current document.", vbCritical
        GoTo lbl_Exit
    End If
    Set oRng = ActiveDocument.Bookmarks("CopyNum").Range
    For Counter = 1 To 3
        Select Case Counter
            Case 1
                oRng.Text = "Original"
            Case 2
                oRng.Text = "Duplicate"
            Case 3
                oRng.Text = "Triplicate"
        End Select
        ActiveDocument.PrintOut
        oRng.Bookmarks.Add "CopyNum"
    Next
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote