|
本帖最后由 何捷 于 2022-11-11 13:51 编辑
Sub saveToPDF()
Dim selectRange As Range
Set selectRange = Range("a1:m19")
selectRange.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\报价单明细\" & [L2&C2] & "PDF"
Application.ScreenUpdating = False
Range("A1:M19").PrintOut Copies:=1
[N1] = [N1] + 1
Application.ScreenUpdating = False
End Sub
Sub 打印()
Dim rng As Range
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set rng = Range("A1:M19")
With CreateObject("Word.Application")
.Visible = False
.Documents.Add
rng.Copy
.Selection.PasteExcelTable False, False, False
.ActiveDocument.SaveAs Filename:=ThisWorkbook.Path & "\报价单明细\" & [L2&C2] & ".doc"
.ActiveDocument.Close
.Quit
End With
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "保存成功,请打印!"
Application.ScreenUpdating = False
Range("A1:M19").PrintOut Copies:=1
[N1] = [N1] + 1
Application.ScreenUpdating = False
End Sub
|
|