0

Please help me on the issue. I have successfully copied the content from one word document to another word document. But the footer format is changed after paste the content. Below is my code.

Sub CopyFile_Blank()
Dim Word As New Word.Application
Dim WordDoc As New Word.Document
Dim WordDoc1 As New Word.Document
Dim dialogBox As FileDialog
Set dialogBox = Application.FileDialog(msoFileDialogOpen)

'Set the display properties - these are optional
'All the settings must be applied before the .Show command

'Do not allow multiple files to be selected
dialogBox.AllowMultiSelect = False

'Set the title of of the DialogBox
dialogBox.Title = "Select a file"

'Show the dialog box and output full file path and file name
If dialogBox.Show = -1 Then
   MsgBox "You selected: " & dialogBox.SelectedItems(1)
End If
    Dest_File = "C:\test\test.docx"
    Doc_Path = Dest_File

Set WordDoc1 = Word.Documents.Open(dialogBox.SelectedItems(1), ReadOnly:=True)
WordDoc1.Range.Copy

Set WordDoc = Word.Documents.Open(Doc_Path, ReadOnly:=True)
WordDoc.Range.PasteAndFormat wdFormatOriginalFormatting

WordDoc.ActiveWindow.Visible = True

WordDoc1.Close
End Sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.