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
'Begin Description
'This script empties the designated output document 
'Requirements: Nothing happens if there are no DraftOutputWindow or it is not the Designated Output
'  It is convenient to "attach" this script to a button on the tool bar
'  A simple clik on the button clears the Output window
'End Description
' Raynald Levesque 2004/04/01

Option Explicit		

Sub Main()
'SCRIPT TO EMPTY DRAFT DESIGNATED OUTPUT WINDOW
            
	Dim objOutputDoc As ISpssDraftDoc
	Dim lngNbDraftDoc As Long
	Dim objDocuments As ISpssDocuments
	Dim Count As Integer, i As Integer, intCount As Integer

	lngNbDraftDoc=objSpssApp.Documents.DraftDocCount
	'If there are no DraftOutput, exit sub
	If lngNbDraftDoc = 0 Then Exit Sub

	Set objDocuments=objSpssApp.Documents
	intCount = objDocuments.DraftDocCount

	For i = 0 To intCount - 1
		Set objOutputDoc = objDocuments.GetDraftDoc(i)
		If objOutputDoc.Designated = True Then
			' Select all items in the output document and delete them :
			objOutputDoc.SelectAll
			objOutputDoc.Delete
			Exit For
		End If
		Set objOutputDoc = Nothing
	Next
End Sub