I have a VBA form for word 2016. In this 'Main Document' I can select other word documents to insert at the cursor point into my document. The docs include mapped content controls, and I find that when they are inserted in this fashion the content controls are empty. When I copy and paste the contents of the files, they transfer perfectly (and the mapped content in the Main Document are then updated to include the transferred information).

Is there a solution to this issue, or another way round?

Following is the code used to insert the files.

If Me.lstSelectedFiles.ListCount > 0 Then
    'loop through selected files
    For i = 0 To Me.lstSelectedFiles.ListCount - 1
        Selection.InsertFile FileName:=Me.lblFilePath.Caption & "\" & Me.lstSelectedFiles.List(i), Range:="", _
            ConfirmConversions:=False, Link:=False, Attachment:=False
    Selection.TypeBackspace 'remove last page break
    MsgBox "You must add at least one file to the selected files list", vbCritical
End If
Unload Me

End Sub

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.