Class TimelineState (Excel VBA)
The timeline-specific state of a SlicerCache object. To use a TimelineState class variable it first needs to be instantiated, for example
Dim tse as TimelineState
Set tse = ActiveWorkbook.SlicerCaches(1).TimelineState
EndDate
Returns the end of the filtering date range (equal to the StartDate property if range is a single day). Read-only Variant.
This property returns an error for either of the following conditions:
Dim dtEndDate As Date
dtEndDate = ActiveWorkbook.SlicerCaches(1).TimelineState.EndDate
FilterType
Returns the type of date filter. Here you can find possible values for
Dim xpfFilterType As XlPivotFilterType
xpfFilterType = ActiveWorkbook.SlicerCaches(1).TimelineState.FilterType
FilterValue1
Returns the first value associated with the date filter (semantics vary by filter type).
Dim varFilterValue1 As Variant
varFilterValue1 = ActiveWorkbook.SlicerCaches(1).TimelineState.FilterValue1
FilterValue2
Returns the second value associated with the date filter (semantics vary by filter type).
Dim varFilterValue2 As Variant
varFilterValue2 = ActiveWorkbook.SlicerCaches(1).TimelineState.FilterValue2
SetFilterDateRange
Sets the timeline's filter. Possible return values are xlFilterStatusDateHasTime - SetFilterDateRange(?): StartDate or EndDate have a time portion, xlFilterStatusDateWrongOrder - SetFilterDateRange(?): StartDate > EndDate, xlFilterStatusInvalidDate - SetFilterDateRange(?): StartDate or EndDate are not valid dates, xlFilterStatusOK - Signifies OK or successful.
SetFilterDateRange (StartDate, EndDate)
Dim dtStartDate As Date: dtStartDate =
Dim dtEndDate As Date: dtEndDate =
Dim xfssSetFilterDateRange As XlFilterStatus
xfssSetFilterDateRange = ActiveWorkbook.SlicerCaches(1).TimelineState.SetFilterDateRange(StartDate:=dtStartDate, EndDate:=dtEndDate)
Arguments
The following arguments are required:
StartDate (Date) - The start of the filtering date range.
EndDate (Date) - The end of the filtering date range.
SingleRangeFilterState
True when the filtering state is a contiguous date range; otherwise, False.
Dim booSingleRangeFilterState As Boolean
booSingleRangeFilterState = ActiveWorkbook.SlicerCaches(1).TimelineState.SingleRangeFilterState
StartDate
Returns the start of the filtering date range. Read-only Variant.
This property returns an error for either of the following conditions:
Dim dtStartDate As Date
dtStartDate = ActiveWorkbook.SlicerCaches(1).TimelineState.StartDate