关于打印的问题??请高手帮忙!谢谢了!
下面是一段关于打印的代码,但我不知道怎么改了!
例如我要打印C:盘了的一个叫dayin.doc的WORD里的内容.该怎么样去改代码呢!请指教!
Dim x As Printer
Dim int1 As Integer
For Each x In Printers
int1 = int1 + 1
If int1 = List1.ListIndex + 1 Then
Set Printer = x: Exit For
End If
Next
Printer.Print "打印第一页 ": Printer.NewPage
Printer.Print "打印第二页 ": Printer.NewPage
Printer.Print "打印第三页 ": Printer.EndDoc
end sub
[解决办法]
Private Sub命令0_Click()
Dim WkWord As New Word.Application
Dim WkDoc As Word.Document
Set WkDoc = WkWord.Application.Documents.Open( "c:\my documents\文件.doc ")
WkDoc.PrintOut False '在printout后面加上FLASE,會等打完之后再關閉
WkDoc.Close
WkWord.Quit
Set WkDoc = Nothing
End Sub
[解决办法]
‘创建word对象
Dim WkWord As New Word.Application
Dim WkDoc As Word.Document
Set WkDoc = WkWord.Application.Documents.Open( "c:\my documents\文件.doc ")
‘打印
WkDoc.PrintOut False '在printout后面加上FLASE,會等打完之后再關閉
‘关闭
WkDoc.Close
WkWord.Quit
Set WkDoc = Nothing
具体代码你可以在word录制宏得到
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
最新版本:20070130
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html