香港新浪網 MySinaBlog
Emily | 3rd Jan 2008, 13:34 PM | WB & WS | (845 Reads)

顯示自定檢視模式名稱 CurrentViews

Function CurrentView(Optional DummyArg As Variant) As String
Dim cbo As CommandBarComboBox
  
On Error Resume Next
Set cbo = Application.CommandBars.FindControl(ID:=950)

On Error GoTo 0
If cbo Is Nothing Then
    With Application.CommandBars.Add(Temporary:=True)
        Set cbo = .Controls.Add(ID:=950)
        .Enabled = False
    End With
End If

CurrentView = cbo.Text

End Function

Sub Test()
    'Application.DisplayStatusBar = True
    'Application.StatusBar = CurrentView
    MsgBox CurrentView
End Sub