View Single Post
 
Old 09-10-2018, 01:34 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
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 of
Default

You appear to have some confusion with your syntax, and while I can't test it without access to the two documents the following should be a deal closer to what you require


Code:
Private Sub CommandButton1_Click()
Dim DocSrc As Document, DocTgt As Document
Dim RngSrc As Range, RngTgt As Range

    Set DocTgt = ActiveDocument
    Set DocSrc = Documents.Open("C:\Users\reception.AIRDG\Documents \Custom Office Templates\2019 Master Specification - Kate.dotm")

    If CheckBox1.Value = True Then
        Set RngSrc = DocSrc.Bookmarks("Demo").Range
        Set RngTgt = DocTgt.Bookmarks("spec").Range
        RngTgt.FormattedText = RngSrc.FormattedText
        RngTgt.Bookmarks.Add "spec"
    End If

    If CheckBox2.Value = True Then
        Set RngSrc = DocSrc.Bookmarks("Surveys").Range
        Set RngTgt = DocTgt.Bookmarks("surveys").Range
        RngTgt.FormattedText = RngSrc.FormattedText
        RngTgt.Bookmarks.Add "surveys"
    End If

    DocTgt.Range.Fields.Update
    Application.ScreenUpdating = True
    Set DocSrc = Nothing
    Set DocTgt = Nothing
    Set RngSrc = Nothing
    Set RngTgt = Nothing
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