想請問各位大大: 我有份EXCEL資料,列印時會一張一張輸出,巨集如下,我想改成不要跳出列印視窗,因為我需要轉成PDF,如果有300頁,我就要存300次,請問要如何改才能直接輸出300頁,只需要存一次檔呢?謝謝!!?

2018-11-08 1:48 pm
Sub Macro1()
Dim I, J As Integer
I = 1
J = 2
Do While I < J
Range("T3").Select
ActiveCell.FormulaR1C1 = I
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
I = I + 1
Loop

End Sub

回答 (1)

2018-11-08 2:49 pm
一頁存一檔
HPage = ActiveSheet.HPageBreaks.Count + 1
VPage = ActiveSheet.VPageBreaks.Count + 1
Toll = HPage * VPage
For i = 1 To Toll
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\轉換資料夾\第" & i & "頁.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=i, To:=i, _
OpenAfterPublish:=False
Next


收錄日期: 2021-05-03 06:49:07
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20181108054800AAqsqui

檢視 Wayback Machine 備份