Message 1 of 4
oPrintMgr.GetSheetRange is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have written a script that will convert a drawing to XPS format and it's working well. The problem is that if I have a drawing with 2 or more sheets only the first sheet is converted to XPS as if it's the only sheet in the drawing. Here is my code, any help would be appreciated
Sub Main() 'Creates a DXF copy of the drawing in the same directory 'as the drawing ' Set a reference to the print manager object of the active document. ' This will fail if a drawing document is not active. Dim oPrintMgr As DrawingPrintManager oPrintMgr = ThisApplication.ActiveDocument.PrintManager oPrintMgr.Printer = "Microsoft XPS Document Writer" ' Set to print in gray oPrintMgr.ColorMode = kPrintGrayScale ' Set to print using portrait orientation. oPrintMgr.Orientation = kLandscapeOrientation ' Set the paper size. oPrintMgr.PaperSize = kPaperSizeA3 ' Set to print full scale. oPrintMgr.ScaleMode = kPrintBestFitScale ' Change the number of copies to 1. oPrintMgr.NumberOfCopies = 1 ' Get and set the current sheet range. Dim iFromSheet As Long Dim iToSheet As Long Call oPrintMgr.GetSheetRange(iFromSheet, iToSheet) ' Change the print range to print all sheets. oPrintMgr.PrintRange = kPrintSheetRange Call oPrintMgr.SetSheetRange(iFromSheet,iToSheet) 'Set File Name and Path path_and_name = ThisDoc.PathAndFileName(False) ' without extension ' Submit the print. oPrintMgr.PrintToFile(path_and_name & ".xps") End Sub