Hi All,

In Access 97 I've created a custom CommandBarButton on a custom Toolbar and I am trying to set a WithEvents reference to that button in a class module. When I run the sub procedure to set the reference I get the Error 430: Class doesn't support automation error.

Here's what I'm doing:
'Class Module Declaration:
Dim WithEvents btnClearSort As CommandBarButton

'Sub Procedure
Public Sub RefCommandBar()
'|Reference CommandBar Controls.|
On Error GoTo Err_RefCommandBar
Dim btnCommandbar As CommandBarButton
Dim strToolbar As String
    strToolbar = Forms(Forms.Count - 1).Toolbar
    If Not strToolbar = "" Then
        Set cbrToolbar = Application.CommandBars(strToolbar)
        For Each btnCommandbar In cbrToolbar.Controls
            If btnCommandbar.Caption = "Clear Sort" Then
                Set btnClearSort = btnCommandbar
            End If
        Next btnCommandbar
    End If
    Exit Sub
    MsgBox "RefCommandBar Error: " & Err.Number & ": " & Err.Description
    Resume Exit_RefCommandBar
End Sub
I'm running this program on a XP SR2 machine, which also has Access 2K loaded. Any ideas as to what is causing this error?