Private Sub btnPrint_Click()
' Selection.GoTo What:=wdGoToBook, Name:="BM_SQH"
' Selection.TypeText Text:=""
On Error Resume Next '忽略错误
Set Wrd = GetObject(, "Word.Application") '查找一个正在运行的Excel拷贝
If Err.Number <> 0 Then '如果 Excel 没有运行则
Set Wrd = CreateObject("Word.Application") '运行它
End If
Err.Clear '清除发生错误的 Err 对象
On Error GoTo 0 '保留普通错误进程
Dim dot As String
Dim doc As String
dot = "dotpath&name"
doc = "docpath&name"
Dim i As Integer
Dim iCount As Integer
iCount = lvCase.ListItems.Count
For i = 1 To iCount
Documents.Open FileName:=dot, _
ConfirmConversions:=False, ReadOnly:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
0
Wrd.Visible = False
Wrd.ActiveDocument.Close
Wrd.Documents.Add Template:=dot, NewTemplate:=False
With Wrd.Application
'.ActiveDocument.PrintPreview
End With
ActiveDocument.SaveAs FileName:=doc, FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ActiveDocument.PrintOut FileName:=doc, Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=2, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Wrd.ActiveDocument.Close
Next
MsgBox "打印完毕", vbInformation, "打印"
lvCase.ListItems.Clear
End Sub
' Selection.GoTo What:=wdGoToBook, Name:="BM_SQH"
' Selection.TypeText Text:=""
On Error Resume Next '忽略错误
Set Wrd = GetObject(, "Word.Application") '查找一个正在运行的Excel拷贝
If Err.Number <> 0 Then '如果 Excel 没有运行则
Set Wrd = CreateObject("Word.Application") '运行它
End If
Err.Clear '清除发生错误的 Err 对象
On Error GoTo 0 '保留普通错误进程
Dim dot As String
Dim doc As String
dot = "dotpath&name"
doc = "docpath&name"
Dim i As Integer
Dim iCount As Integer
iCount = lvCase.ListItems.Count
For i = 1 To iCount
Documents.Open FileName:=dot, _
ConfirmConversions:=False, ReadOnly:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
0
Wrd.Visible = False
Wrd.ActiveDocument.Close
Wrd.Documents.Add Template:=dot, NewTemplate:=False
With Wrd.Application
'.ActiveDocument.PrintPreview
End With
ActiveDocument.SaveAs FileName:=doc, FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ActiveDocument.PrintOut FileName:=doc, Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=2, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Wrd.ActiveDocument.Close
Next
MsgBox "打印完毕", vbInformation, "打印"
lvCase.ListItems.Clear
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货