In this section there is a list of SPSS OLE objects bugs I found. I think they are bugs just because the
properties/methods haven't worked as explained in the help file containing the SPSS Objects documentation.
If you have discovered other bugs or if you have some comments regarding the bugs here listed, don't hesitate
sending me an email message at spss-scripts@go.to.
It seems that the GetDocumentPath method of ISPSSDataDoc object isn't able to return the correct
datafile name whenever the actual file name doesn't have the default SAV extension.
If SPSS has loaded a datafile whose name hasn't the SAV extension, GetDocumentPath returns "Untitled" instead
of the datafile name.
On the other way, if the loaded file name has the SAV extension, the methods correctly returns the
current dataset's file name.
The OpenDocument method of
ISPSSApp object opens an SPSS Document file. Although a script isn't
properly an SPSS Document, I found this method capable of opening a script window.
The unexpecting thing is that if a script window is opened with this method, the script will not work, just
because the SPSS objects are not available.
Therefore a script window opened with OpenDocument will not run because it doesn't see the SPSS
objects: in fact the object browser, when invoked by this window, doesn't show the SPSS objects.
The TextStyleAt property of ISpssDataCells object (contained in the PivotTable object),
doesn't return the correct addressed cell's text style: it always returns 0 (Regular: SpssTSRegular=0).
On the other way, when setting a new style to a cell, this property works properly.
The following script demonstrates the bug:
The message box containing 0 demonstrates this bug.
Sub Main
Dim objPivot As PivotTable, objItem As ISpssItem
Dim bolFoundOutput As Boolean, bolFoundPivot As Boolean
Dim objDataCells As ISpssDataCells
GetFirstSelectedPivot objPivot, objItem, bolFoundOutput, bolFoundPivot
Set objDataCells = objPivot.DataCellArray
objDataCells.TextStyleAt(0,0) = SpssTSBoldItalic
MsgBox "Text Style code of modified data cell: " & objDataCells.TextStyleAt(0,0)
objItem.Deactivate
End Sub
Note: the TextStyleAt property of the ISpssLabels object works properly.
The TextUnderlinedAt property of ISpssDataCells object (contained in the PivotTable object),
returns the opposite of the expected logical value. If the addressed cell is underlined,
this property returns False. If the addressed cell is not underlined, it
returns True.
On the other way, when setting the underlined style to a cell, this property works correctly.
The following script demonstrates the bug:
If the message box displays that cell at (0,0) is not underlined, and cell at (0,1) is underlined, then this bug has been demonstrated.
Sub Main
Dim objPivot As PivotTable, objItem As ISpssItem, bolFoundOutput As Boolean, bolFoundPivot As Boolean
Dim objDataCells As ISpssDataCells
GetFirstSelectedPivot objPivot, objItem, bolFoundOutput, bolFoundPivot
Set objDataCells = objPivot.DataCellArray
objDataCells.TextUnderlinedAt(0,0) = True
objDataCells.TextUnderlinedAt(0,1) = False
MsgBox "Data cell (0,0) underlined: " & objDataCells.TextUnderlinedAt(0,0) & vbCr+ _
"Data cell (0,1) underlined: " & objDataCells.TextUnderlinedAt(0,1)
objItem.Deactivate
End Sub
Note: the TextUnderlinedAt property of the ISpssLabels object works properly.
The Group method of PivotTable object, does not group table's selected category or group labels, as explained in the documentation. Only the last selected label is demoted one level, in order to leave space to the inserted grouping level.
This method inserts the grouping label, which groups only the last selected category label, and not all selected category labels, as expected.
The GetSelectedVariables function of the ISpssInfo object, does not return the correct
indexes of the beginning and ending variables of the selection in the datafile
(startindex, endindex parameters).
In the documentation is explained that returned indexes are 0-based, but actually
they are 1-based.
The following script demonstrates the bug:
If the message box displays the 2nd variable name (RACE) and the 4th variable name (HAPPY) as the begginging and ending variables of the selection, then this bug has been demonstrated.
Sub Main
Dim objData As ISpssDataDoc, objInfo As ISpssInfo
Dim startIndex As Long, endIndex As Long, Selected As Boolean
With objSpssApp
Set objData = .OpenDataDoc(.GetSPSSPath+"\1991 U.S. General Social Survey.sav")
Set objInfo = .SpssInfo
End With
objData.Visible = True
objData.SelectVariables "sex", "region"
Selected = objInfo.GetSelectedVariables (startIndex, endIndex)
If Selected Then
MsgBox "First selected var.= "+UCase(objInfo.VariableAt(startIndex))+vbCr+ _
"Last selected var.= "+UCase(objInfo.VariableAt(endIndex))
End If
End Sub