- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- パーマリンクを表示
- 印刷
- 報告
Hey,
I asked a number of questions last week to make my code shorter:
This has succeeded, but now a number of other challenges have arisen. That's why this new forum.
Broadly speaking, the code works. Only that shows strange behavior in combination with a form.
I have made 3 parameters. I can set this to true / false in the form. If the check mark is on, they will be printed and if the check mark is off they will not be printed. In the image below, only Sheet 2 would now be printed.
The idea is that you can first check/uncheck which pages you want. By then pressing the 'Printing' button, printing the desired pages. The best thing would then be that the form box closes. Behind the 'Printing' button I have the following behavior: On Click Action - Apply and then Run Rule.
The code used behind the 'Printing' button is:
Dim oDrgDoc As DrawingDocument Dim oDrgPrintMgr As DrawingPrintManager oDrgDoc = ThisApplication.ActiveDocument oDrgPrintMgr = oDrgDoc.PrintManager ' Provide the good status to the page ThisDoc.Document.Sheets.Item("Sheet1:1").ExcludeFromPrinting = Not(Sheet1) ThisDoc.Document.Sheets.Item("Sheet2:2").ExcludeFromPrinting = Not(Sheet2) ThisDoc.Document.Sheets.Item("Sheet3:3").ExcludeFromPrinting = Not(Sheet3) '--------Printing-------- 'Printer name oDrgPrintMgr.Printer = "Microsoft Print to PDF" oDrgPrintMgr.SetSheetRange(1,3) 'Paper size, scale and orientation oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSize11x17 oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintSheetRange oDrgPrintMgr.Orientation = PrintOrientationEnum.kLandscapeOrientation oDrgPrintMgr.SubmitPrint()
I can now check/uncheck which pages I want. Then I can push the button 'Printing' and save the pdf. If I then press 'save' it saves the file neatly. But then he asks to save it again. If I do that, it will close the PDF printing. But then I have 2 the same files. I don't know why he does this. In addition, I am unable to close the form if I have printed the file as a pfd.
Hopefully someone can help me with this. Thanks in advance.
解決済! 解決策の投稿を見る。