'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