小弟時常需要把文件存成PDF檔案
想請教如何設計一個巨集,列印存成PDF檔案?
想嘗試兩種方式
1.列印 -> PDF->以B12儲存格為檔名 -> 可選擇存擋位置
2.列印 -> PDF->以B12儲存格為檔名 -> 自動儲存在C:\文件\
還有個小問題
如果想在B12欄位裡 結合F12+F16+F17儲存格的文字
並且中間以“ _ ” 底線做分隔
可以用什麼公式達成?
ps: F17是用Vlookup帶出的日期格式
File_Name = Range("B12").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:="C:\文件\" & File_Name & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
-----------------------------------------
B12 裡的函數 =F12&"_"&F16&"_"&TEXT(F17,"yyyymmdd")
File_Name = Range("B12").Value
Sheet_Name = InputBox("輸入要列印的工作表名稱", , "工作表1")
Sheets(Sheet_Name).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:="C:\文件\" & File_Name & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
File_Name = Range("B12").Value
Page1 = InputBox("輸入要列印的起始頁數", , 1)
Page2 = InputBox("輸入要列印的結束頁數", , 1)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:="C:\文件\" & File_Name & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False, From:=Page1, To:=Page2
End Sub
內文搜尋

X