只要指定的數(shù)據(jù)透視圖視圖或數(shù)據(jù)透視表視圖重畫,該事件就會(huì)發(fā)生。
Private Sub Form_ViewChange(ByVal Reason As Long)
Reason PivotViewReasonEnum 常量,表明視圖有哪些改動(dòng)。對(duì)于數(shù)據(jù)透視圖視圖,Reason 總是返回–1。
下面的示例說明了捕獲 ViewChange 事件的子程序的語(yǔ)法。為了使該示例奏效,必須設(shè)置一個(gè)對(duì) Microsoft Office Web Components 10.0 類型庫(kù)的引用。
Private Sub Form_ViewChange(ByVal Reason As Long)
If Reason = OWC.plViewReasonShowDetails Then
MsgBox "You've opted to show details."
End If
End Sub