Date: Fri, 4 Oct 2002 09:41:23 +0200
Reply-To: tech@spss-sa.com
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Tasneem Jappie <tech@spss-sa.com>
Subject: IGraph script
Content-Type: text/plain; charset="iso-8859-1"
Hi,
I'm busy modifying an IGraph script. I call 7 subroutines which
all format the IGraph in some way. All of these sub routines, except one,
iterate through all IGraphs. When I include the sub below I get the
following error message:
"SetMyVariableManager=MyIGraph.VariableMgr(&h80004005) (&80004005)Exception
80004005". When I exclude it, all the remaining routines run through all the
IGraphs in the output window.
Do you why this is so, and what can I do about it.
Const SpssIGraphX1 As Integer = 0
Const SpssIGraphY As Integer = 1
Const SpssIGraphGridLineAtMajorTicks As Integer = 0
Const spssAxisLabelAllCategories As Integer = 2
Const spssAxisLabelHorizontal As Integer = 1
Const SpssIGraphTickFormatFloating As Integer = 0
Const vbWhite As Long = 16777215
Const vbBlue As Long = 16711680
Const vbCyan As Long = 16776960
Const vbGreen As Long = 65280
Const vbMagenta As Long = 16711935
Const vbRed As Long = 255
Const vbYellow As Long = 65535
Const vbBlack As Long = 0
Public MyIGraph
Option Explicit
Sub Main
'Get the designated Output window:
Dim objOutputDoc As ISpssOutputDoc
Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc
' Declare variables and get the output items object:
Dim objOutputItems As ISpssItems
Dim objOutputItem As ISpssItem
Dim MyIGraph As ISpssIGraph
Set objOutputItems = objOutputDoc.Items()
Dim DimensionSlot As Integer
Dim MyScaleDimension As ISpssIGraphDimension
Dim DimensionVariableName() As String
' Get each item in the Navigator.
Dim i As Integer
For i = 0 To objOutputItems.Count - 1
Set objOutputItem = objOutputItems.GetItem(i)
If objOutputItem.SPSSType=SPSSIGraph Then
Set MyIGraph = objOutputItem.Activate
Call FormatScaleDimension(MyIGraph, SpssIGraphY)
objOutputItem.Deactivate
End If
Next
End Sub
Public Sub FormatScaleDimension(MyIGraph As ISpssIGraph, DimensionSlot As
Integer)
' Declare variables
Dim MyScaleDimension As ISpssIGraphDimension
Dim DimensionVariableName() As String
Dim MyVariableMgr As ISpssIGraphVariablesMgr
' First you need to make sure that the slot contains at least one variable
and get the name
' of the variable(s). GetAssigned returns False if the specified slot does
not contain a variable
Set MyVariableMgr= MyIGraph.VariablesMgr
If MyVariableMgr.GetAssigned(SpssIGraphY, DimensionVariableName) = True Then
' Next, check to see if the first variable is a scale variable.
If MyVariableMgr.Categorical(DimensionVariableName(0)) = False Then
'If it's a scale variable, retrieve its dimension object
Set MyScaleDimension = MyIGraph.VariablesMgr.GetDimension(SpssIGraphY)
With MyScaleDimension
' Turn off Automatic Scale Maximum
' .ScaleMaxAutomatic = False
' Set the Max to %90 of the Data's maximum
' .ScaleMax = .DataMax * .9
' Reverse the Scale
' .ReverseScale = True
.TickInterval=10
End With
' Always redraw the graph after making changes
MyIGraph.Redraw
End If
End If
End Sub
Tasneem Jappie
Technical & Training Support
SPSS-SA
Silvermine House
Steenberg Office Park
Tokai 7945
South Africa
Tel +27 21 702 4666
Fax +27 21 702 4333
E-mail: tech@spss-sa.com
Web: www.spss-sa.com