VBA 为什么用VBA打开了二个WORD并打印它们,但实际上只打印了第一个WORD,谢谢
Private Sub Command1_Click()
Dim Ap As Word.Application
Dim newDoc As Document
Set Ap = CreateObject("word.application")
Ap.Visible = True
Set newDoc = Ap.Documents.Add
....
newDoc.SaveAs App.Path & "\AAAAAA.doc"
For i = 1 To 3
ActiveDocument.PrintOut
Next i
newDoc.Close
Ap.Quit
Set Ap = Nothing '消灭对象变量
Set newDoc = Nothing
Dim objWDApp As New Word.Application
Dim objDoc As New Word.Document
Dim strTitle As String
Set objDoc = objWDApp.Documents.Add
.....
objDoc.SaveAs App.Path & "\BBBBBB.doc"
For i = 1 To 3
ActiveDocument.PrintOut
Next i
objDoc.Close
objWDApp.Quit
Set objWDApp = Nothing '消灭对象变量
Set objDoc = Nothing
End Sub
[解决办法]
是newDoc.PrintOut和objDoc.PrintOut。自己试试不就行了,还来问。