-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExcel4APivotItemInfo.cls
84 lines (63 loc) · 1.86 KB
/
Excel4APivotItemInfo.cls
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "PivotItemInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Unrestricted class
Public Parent As PivotFieldrInfo
Public item As pivotItem
Public Name As String
Public IsBlank As Boolean
Public IsAll As Boolean
Public Property Get Selected() As Boolean
If Me.IsAll Then
Selected = True
Else
Selected = Me.item.Visible = True
End If
End Property
Public Property Let Selected(value As Boolean)
If Me.IsAll Then
If value = True Then
Call Me.Parent.SelectAll
Else
Call Me.Parent.SelectBlank
End If
ElseIf Not Me.item.Visible = value Then
Me.item.Visible = value
If Me.Parent.MultiSelection = False Then
Me.Parent.Field.CurrentPage = IIf(value = True, Me.item.Caption, "(blank)")
End If
End If
End Property
Public Sub SetName(pItem As pivotItem)
On Error Resume Next
Dim sSetName As String
sSetName = Trim(pItem.SourceName)
If IsEmpty(sSetName) = True Then
sSetName = Trim(pItem.Caption)
End If
Me.Name = sSetName
On Error GoTo 0
End Sub
Public Function SetPivotItem(pItem As pivotItem, parentFilter As PivotFieldrInfo) As PivotItemInfo
Set SetPivotItem = Me
Set Me.Parent = parentFilter
Set Me.item = pItem
Call Me.SetName(pItem)
Me.IsBlank = Me.Name = "(blank)"
Me.IsAll = Me.Name = "(All)"
End Function
Public Function SetAsAllPivotItem(parentFilter As PivotFieldrInfo) As PivotItemInfo
Set SetAsAllPivotItem = Me
Set Me.Parent = parentFilter
Set Me.item = Nothing
Me.Name = "(All)"
Me.IsBlank = False
Me.IsAll = True
End Function