请帮助我解决这个问题。我已成功将内容从一个 word 文档复制到另一个 word 文档。但粘贴内容后页脚格式发生了变化。以下是我的代码。
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