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
64
65
66
67
68
69
' Add a footnote to every Pivot Table in the viewer
' Raynald Levesque 2004/03/18

Option Explicit

' Change next line as required
Const cFOOTNOTE="Weighted by weight1"

Sub Main
'Add same footnote to every Pivot Table.
Dim objOutputDoc As ISpssOutputDoc
Dim objOutputItems As ISpssItems
Dim objOutputItem As ISpssItem
Dim objPivotTable As PivotTable
Dim intCount As Integer
Dim IntItem As Integer

Dim I As Integer
	Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc
	Set objOutputItems=objOutputDoc.Items
	' Get each pivot table
	For IntItem = 0 To objOutputItems.Count - 1
		Set objOutputItem = objOutputItems.GetItem (IntItem)
		If objOutputItem.SPSSType = SPSSPivot Then
		    Set objPivotTable = objOutputItem.ActivateTable
			Call InsertFootnote(objPivotTable,cFOOTNOTE)
		    objOutputItem.Deactivate
		End If
	Next IntItem
 End Sub



Sub InsertFootnote (objTable As PivotTable , strFootnote As String )
' Insert a footnote at bottom of currently activated Pivot Table
	Dim objDataCells As ISpssDataCells
	Dim objFootnotes As ISpssFootnotes

	Set objDataCells=objTable.DataCellArray
	Set objFootnotes=objTable.FootnotesArray

	objTable.UpdateScreen=False
	objDataCells.SelectCellAt (0,0)
	objTable.InsertFootnote(strFootnote)
	objTable.ClearSelection

	objFootnotes.ChangeMarkerToSpecial (0, " ")

	'Now we select the footnotes to perform some cosmetic changes
	objTable.SelectAllFootnotes

	'Decrease the footnote size
	objTable.TextSize= 7

	'Left justify the footnotes
	objTable.HAlign=0
	'0 SpssHAlLeft (Left)
	'1 SpssHAlRight (Right)
	'2 SpssHAlCenter (Center)

	'Maintain the font style of footnotes
	objTable.TextStyle=0
	'0 SpssTSRegular (Regular)
	'1 SpssTSItalic (Italic)
	'2 SpssTSBold (Bold)
	'3 SpssTSBoldItalic (Bold Italic)

	objTable.UpdateScreen= True
End Sub