'Begin Description 'Purpose: To switch the printing orientation between landscape and portait. ' The change applies to the full content of the current Output window. 'Assumptions: None (an Output Window will be created if there are none) 'Inputs: The script is called from a syntax file using the following sample coding: ' SCRIPT "c:\\your path\\PrintOrientation.sbs" ("1Page Header") <----- to get portrait ' SCRIPT "c:\\your path\\PrintOrientation.sbs" ("2Any Page Header") <----- to get landscape 'Author: Raynald Levesque rlevesque@videotron.ca 'End Description ' Future improvements upon each call, apply orientation then create a new Output file (output1, output2, etc) ' with portrait orientation. When script is called with the ("0") parameter, print all Output Windows. Maintain ' pagination from one Output to the other. Option Explicit Dim strHeader As String Sub Main Dim intOrient As Integer, StrErr As String 'Error handler StrErr = "Input parameter must be 1 or 2:" On Error GoTo ErrLoad 'Get input from syntax (next line will result in error if input is not a number) strHeader = objSpssApp.ScriptParameter(0) ' strHeader = "1My Title" intOrient = CInt(Mid(strHeader,1,1)) If Len(strHeader) > 1 Then strHeader = Mid(strHeader,2) Else strHeader = "" End If If intOrient <> 2 Then intOrient = 1 'make portait the default orientation 'Call sub to do the job PrintOrient(intOrient) Exit Sub ErrLoad: MsgBox StrErr & vbCr & Err.Description, vbExclamation, "Error " & Err 'display warning for the user Debug.Print StrErr & vbCr & "Error " & Err 'for the record Exit Sub End Sub Sub PrintOrient(intOrient As Integer) Dim objOutputDoc As ISpssOutputDoc Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc With objOutputDoc.PrintOptions .HeaderText = strHeader .FooterText = "Run at " & Time & " on " & Date & " Page &[Page]" .StartingPageNumber = 1 End With objOutputDoc.PrintOptions.Orientation=intOrient End Sub