
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PDF印刷設定のマクロ
いつもお世話になっております。
レポート設定した後、PDFの形式で特定のフォルダに保存するマクロを作ろうとしています。
PDFファイルを各差し込み設定で分割したいので、PDF毎に名前を付けて保存したいのですが、うまく設定できません。
何か良い方法はありますでしょうか?
'// ****************************************************************
'// 差し込み印刷
'//
'// ****************************************************************
Sub BM_Print
vReport = "RP-01" 'Set report
bookmarks = ActiveDocument.GetUserBookmarkNames
for i = 0 to UBound(bookmarks)
bm = bookmarks(i)
msgbox(bm)
vName = bm 'Name of output pdf
ActiveDocument.PrintReport(vReport), "PDF-XChange 3.0", false 'Printreport
reportFile = "C:\Users\AAA\Downloads" & vName &".pdf" 'Setting outputname
printReportPDF vReport,reportFile
ActiveDocument.GetApplication.Sleep 5000
zendDagrapport reportFile
next
End Sub
- Tags:
- Group_Discussions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ブックマークで差し込みにしたいファイルを設定していたのですが、フィールド毎で出力はできるようです。
ただ、保存の時に毎回ファイル名を聞かれるので なんとか名前を指定して保存にしたいのですが・・・
'===========================================================================
sub PrintPDF
set f = ActiveDocument.Fields("Custname")
set sel = f.GetSelectedValues
for i = 0 to sel.Count-1
f.Select sel.Item(i).text
path="C:\Users\AAA\Downloads\"
filename = sel.Item(i).text
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.PrintDocReport "RP-01", "PDF-XChange 3.0"
reportFile = path & filename & ".pdf"
' MsgBox filename
next
f.SelectValues sel
end sub
'===========================================================================
