1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'Begin Description 
'This script saves the current Designated Output window, closes it and Open a new one
'The path and filename are specified at the beginning of the script
'rlevesque@videotron.ca
'End Description

Option Explicit 

Sub Main 
Dim objOutputDoc As ISpssOutputDoc 
Dim strParam As String 

Dim i As Integer 
Dim objDocuments As ISpssDocuments 
Dim strPath As String
Dim strFileName As String
' ******** Change the next 2 lines as required
strPath 	= "c:\\temp\\"	'If this is left blank, current folder will be used
strFileName = "FileName.spo"

Set objDocuments = objSpssApp.Documents 

If objDocuments.OutputDocCount > 0 Then 
	Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc 
	
	'check to see if there is a specified path 
	If InStr(strPath, "\\") > 0 Then 
		objOutputDoc.SaveAs strPath & strFileName 
		Else 'if no path specified, use the current directory 
		objOutputDoc.SaveAs objSpssApp.GetSPSSPath & strFileName 
	End If 
End If 

'close the OutputDoc ... 
objOutputDoc.Close 
'open a new window and make it visible 
objSpssApp.NewOutputDoc 
objSpssApp.NewOutputDoc.Visible = True 

End Sub