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 the code:
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?
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 the code:
Code:
[COLOR=green]'Class Module Declaration:[/color]
Dim WithEvents btnClearSort As CommandBarButton
[COLOR=green]'Sub Procedure[/color]
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_RefCommandBar:
Exit Sub
Err_RefCommandBar:
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?