ygxshanghai 2012年08月07日
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
...全文
60 点赞 收藏 4
写回复
4 条回复

还没有回复,快来抢沙发~

发动态
发帖子
VBA
创建于2007-09-28

1570

社区成员

1.0w+

社区内容

VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区公告
暂无公告