Date: Sat, 12 Apr 2003 11:46:46 +0300
Reply-To: Alex Vinogradov <alexwin@univ.kiev.ua>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Alex Vinogradov <alexwin@univ.kiev.ua>
Subject: Re: Unstable script + Kill function
Hi Luca,
It seems to me that the possible cause of instability is the activation of tables in the following block of code:
If intItemType=5 Then
If objOutputItem.ActivateTable.TitleText="GRAPH 1" Then
objOutputItem.Selected = True
End If
End If
First of all, this code activates all pivot tables in the output regardless of title. When in-place (default) activation is set, this may cause the problem.
Spss help clearly says you must deactivate table after use.
I would use the following code:
If intItemType=5 Then
If objOutputItem.GetTableOleObject.TitleText = "GRAPH 1" Then
objOutputItem.Selected = True
End If
End If
HTH
Dr. Alexander Vinogradov
Faculty of Sociology and Psychology,
Kyiv National University, Ukraine
\\\\\\\\\\\\\\\\\\\\
Date: Thu, 10 Apr 2003 20:07:07 +0200
From: Luca Meyer <luca@lucameyer.com>
Subject: Unstable script + Kill function
Can anyone suggest why the following script is quite unstable, as
apparently it randomly runs all right and then it crashes SPSS? What's
wrong with it?
I have also tried to insert a Kill strFile after the strFile line and
before the objOutputDoc.ExportDocument line and in such a case it
crashes all the times...
Thank you,
Luca
Syntax:
Sub Main
Dim objOutputDoc As ISpssOutputDoc
Dim objOutputItems As ISpssItems
Dim objOutputItem As ISpssItem
Dim objSpssPivot As PivotTable
Dim intItemCount As Integer
Dim intItemType As Integer
Dim index As Integer
Dim strFile As String
Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc
objOutputDoc.Visible = True
Set objOutputItems = objOutputDoc.Items
intItemCount=objOutputItems.Count
For index=0 To intItemCount-1
Set objOutputItem=objOutputItems.GetItem(index)
intItemType=objOutputItem.SPSSType
If intItemType=5 Then
If objOutputItem.ActivateTable.TitleText="GRAPH 1" Then
objOutputItem.Selected = True
End If
End If
If intItemType=10 Then
If objOutputItem.GetIGraphOleObject.Title="GRAPH 2" Then
objOutputItem.Selected = True
Exit For
End If
End If
Next
strFile="c:temp1.htm"
objOutputDoc.ExportDocument(SpssSelected,strFile,SpssFormatHtml,True)
End Sub
\\\\\\\\\\\\\\\\\\\\