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
' Экспорт видимых сводных таблиц (Pivot Tables) в MS PowerPoint
' Размещено в SPSSX-L 23.7.2003. Автор: Alex Vinogradov.

Dim objPowerPoint As Object
Dim objPresentation As Object
Dim objOutput As ISpssOutputDoc

Sub Main
  CreatePowerPoint
  CopySlides
End Sub

Sub CreatePowerPoint
  On Error Resume Next
  Set objPowerPoint = CreateObject("Powerpoint.Application")
  Set objPresentation = objPowerPoint.Presentations.Add
  objPowerPoint.Visible = True
End Sub

Sub CopySlides()
  Dim objItems As ISpssItems
  Dim objItem As ISpssItem
  Dim i,slide As Long

  On Error Resume Next

  If objSpssApp.Documents.OutputDocCount > 0 Then
    Set objOutput = objSpssApp.GetDesignatedOutputDoc
    Set objItems = objOutput.Items

    For i = 0 To objItems.Count - 1
      Set objItem = objItems.GetItem(i)
      If (objItem.SPSSType = SPSSPivot) And objItem.Visible Then
        objPresentation.Slides.Add 1,12
      End If
    Next

    slide = 0
    For i = 0 To objItems.Count - 1
      Set objItem = objItems.GetItem(i)
      If (objItem.SPSSType = SPSSPivot) And objItem.Visible Then
        slide = slide + 1
        objPowerPoint.ActiveWindow.View.GotoSlide slide
        objItem.Deactivate
        Clipboard ""
        objOutput.ClearSelection
        objItem.Selected = True
        objOutput.Copy
        objPowerPoint.ActiveWindow.View.Paste
      End If
    Next
  End If

End Sub