DraftDocument PrintOut Sub. How can I print a specific sheet.
DraftDocument PrintOut Sub. How can I print a specific sheet.
(OP)
This is my first post.
I have been programing diferent tools using VBA in Excel that work with SE.
Now I am trying to print a specific sheet of a draft document.
I open the draft document, detect the sheets size and orientation but I can't print out only a specific sheet.
The function I am using is:
Sub PrintOut([Printer], [NumCopies], [Orientation], [PaperSize], [Scale], [PrintToFile], [OutputFileName], [PrintRange], [Sheets], [ColorAsBlack], [Collate])
For example whith an open document:
Set objApp = GetObject(, "SolidEdge.Application")
Set objDoc = Nothing
Set objDoc = objApp.Documents.Open(CStr(Trim(celda.Value)))
lPaperSize = objDoc.ActiveSheet.SheetSetup.SheetSizeOption
lPaperOrient = 1
Call objDoc.PrintOut(Orientation:=lPaperOrient, ColorAsBlack:=True, PaperSize:=lPaperSize)
The document have 3 pages or sheets and I want to print only sheet 1 (call sheet "Sheet1") but I can't.
I have tried lots of posibilities but I can't do it.
I need some help.
I have been programing diferent tools using VBA in Excel that work with SE.
Now I am trying to print a specific sheet of a draft document.
I open the draft document, detect the sheets size and orientation but I can't print out only a specific sheet.
The function I am using is:
Sub PrintOut([Printer], [NumCopies], [Orientation], [PaperSize], [Scale], [PrintToFile], [OutputFileName], [PrintRange], [Sheets], [ColorAsBlack], [Collate])
For example whith an open document:
Set objApp = GetObject(, "SolidEdge.Application")
Set objDoc = Nothing
Set objDoc = objApp.Documents.Open(CStr(Trim(celda.Value)))
lPaperSize = objDoc.ActiveSheet.SheetSetup.SheetSizeOption
lPaperOrient = 1
Call objDoc.PrintOut(Orientation:=lPaperOrient, ColorAsBlack:=True, PaperSize:=lPaperSize)
The document have 3 pages or sheets and I want to print only sheet 1 (call sheet "Sheet1") but I can't.
I have tried lots of posibilities but I can't do it.
I need some help.





RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
before the RpintOut use this:
objDoc.Sections.WorkingSection.Sheets.Item(" your sheet name here ").Activate
Note: the name of the sheet must be typed exactly as found on the tab.
HTH
dy
RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
I did this:
objDoc.Sections.WorkingSection.Sheets.Item("Hoja1").Activate
Call objDoc.PrintOut(Orientation:=lPaperOrient, ColorAsBlack:=True, PaperSize:=lPaperSize, Scale:=1#)
But it still printing all pages of the document.
Do you have another one?
thenks
RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
may I point out that the PrintOut method also has a PrintRange
argument which can be given as:
igPrintSelected = last active sheet
igPrintAll = all sheets
igPrintSpecified = a range of sheets (i.e 2 to 5 ...)
dy
RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
I can not make it work. Could you please give me a complete example.
Thank you very much.
MS
RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
Set oApp = GetObject(, "SolidEdge.Application")
Set oDraft = oApp.ActiveDocument
Call oDraft.Sections.WorkingSection.Sheets.Item("Connector 3 complete").Activate
Call oDraft.PrintOut(Printer:="Adobe PDF", Orientation:=vbPRORLandscape, PaperSize:=vbPRPSA3, PrintRange:=igPrintSelected)
Note: lPaperSize = objDoc.ActiveSheet.SheetSetup.SheetSizeOption
will give you SE's paper size but needed is the papersize constant for the
Printer. See also the sample Batch program within C:\...\Custom
These are standard up to at most A3
A4 = vbPRPSA4 = 9 (SE SheetSizeOption = igIsoA4Tall =28)
A3 = vbPRPSA3 = 8 (SE SheetSizeOption = igIsoA3Wide = 31)
A2 = 66 (but this may vary from printer to printer)
(SE SheetSizeOption = igIsoA2Wide = 33
dy
RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
I am very gratefull, it is working now.
Please if you need help in other topics let me know.
MS
RE: DraftDocument PrintOut Sub. How can I print a specific sheet.
you're welcome. To obtain the papersize constants for formats
that are not enumerated you may use the program PaperSizeConstants
(see link below)
dy