Toggle Output Type
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ' Show current output type: draft output or object output, ' and switch on request to the other output type. ' ' Switching output type: ' If there is no open draft/object output document, a new draf/object output ' document is opened; else the last draft/object document is designated as ' the active output document (to be specific: the LAST CREATED draft/object ' output WINDOW is designated as the the active output window). ' ' If you put this script under a toolbar button in the syntax window, ' you can easily switch between draft and object output without leaving the ' syntax window. ' ' This script is written with SPSS release 10.1.4 ' Karel Asselberghs asselberghs@dds.nl Sub Main Dim objSPSSOptions As ISpssOptions Dim objDocuments As ISpssDocuments Dim objOutputDoc As ISpssOutputDoc Dim objDraftDoc As ISpssDraftDoc Dim count As Integer Dim OutputType As Integer Set objSPSSOptions = objSpssApp.Options Set objDocuments = objSpssApp.Documents OutputType = objSPSSOptions.CurrentOutputType If OutputType = 0 Then If MsgBox("Switch to draft output?",vbOkCancel,"Object output") <> vbOK Then Exit All End If Else If MsgBox("Switch to object output?",vbOkCancel,"Draft output") <> vbOK Then Exit All End If End If If OutputType = 0 Then ' if SPSSObjectOutput count = objDocuments.DraftDocCount If count = 0 Then objSPSSOptions.CurrentOutputType = 1 Else Set objDraftDoc = objDocuments.GetDraftDoc(count-1) ObjDraftDoc.Designated = True End If Else ' if SPSSDraftOutput count = objDocuments.OutputDocCount If count = 0 Then objSPSSOptions.CurrentOutputType = 0 Else Set objOutputDoc = objDocuments.GetOutputDoc(count-1) ObjOutputDoc.Designated = True End If End If If OutputType = 1 And objSPSSOptions.CurrentOutputType = 1 Then MsgBox "Failed to switch to Object output",,"Draft output" ElseIf OutputType = 0 And objSPSSOptions.CurrentOutputType = 0 Then MsgBox "Failed to switch to Draft output",,"Object output" End If End Sub |
Related pages
...