求,一个连续打印的VBA
求,一个连续打印的VBA--------------------编程问答--------------------
录制宏 --------------------编程问答-------------------- +
我刚好写过一个,简单的(参数:页码范围,打印份数,打印文件名)
Function PrintOutWord(ByVal PrintType As String, ByVal CopyNum As Byte, ByVal patName As String) As Boolean--------------------编程问答--------------------
Dim PageNum As String
On Error GoTo 10
Set WdApp = New Word.Application
WdApp.Documents.Open FileName:=patName, _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto, XMLTransform:=""
WdApp.Visible = False
If PrintType = "全部" Then
WdApp.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=Format(CopyNum), Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=False, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Else
Do While InStr(PrintType, ",") <> 0
PrintType = Replace(PrintType, ",", ",")
Loop
WdApp.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=Format(CopyNum), Pages:=PrintType, PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=False, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End If
WdApp.ActiveWindow.Close
PrintOutWord = True
Set WdApp = Nothing
Exit Function
10 PrintOutWord = False
End Function
补充:VB , VBA