您好,经过测试应该这样写:
Dim wApp As Object
'Dim wDoc As Word.Document
Private Sub Command1_Click()
Merge "c:\1.docx", "c:\2.docx", wApp
Form1.Caption = "OK"
End Sub
Private Sub Form_Load()
Set wApp = New Word.Application
End Sub
Function Merge(ByVal sFirstFile As String, ByVal sSecondFile As String, ByRef wrdapp As Word.Application) As Boolean
Dim docNew As Word.Document
'open the main document
Set docNew = wrdapp.Documents.Open(sSecondFile)
'insert the coversheet
wrdapp.Selection.InsertFile FileName:=sFirstFile, Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
'set position to first page/coversheet
wrdapp.Selection.MoveUp Unit:=wdScreen, Count:=1
'force header/footer to begin on 2nd page
With wrdapp.Selection.PageSetup
.DifferentFirstPageHeaderFooter = True
End With
'save the document
docNew.SaveAs "C:\NewFile.docx"
'''''''
docNew.close
End Function