CommandBar objektet
Når jeg kører nedenstående kode, får jeg fejlen: "User-defined type not defined" ved linien:Dim strCBBarName As String
.......(eksemplet er taget fra Access' hjælpefil, så.......mangler jeg en reference til noget eller hvad?)
Sub GetCommandBarInfo()
Dim strCBBarName As String
strCBBarName = InputBox("Enter the name of a command bar", "Get CommandBar Information", "Menu Bar")
If Len(strCBBarName) > 0 Then
CommandBarInfo strCBBarName
End If
End Sub
Sub CommandBarInfo(strCBBarName As String)
Dim cbr As CommandBar
On Error Resume Next
Set cbr = CommandBars(strCBBarName)
If Err = 0 Then
With cbr
MsgBox "The command bar named '" & .Name & "' contains " & _
.Controls.Count & IIf(.Controls.Count = 1, " control and ", _
" controls and ") & IIf(.BuiltIn, "is", "is not") & _
" a built-in toolbar", vbOKOnly, "'" & _
.Name & "' Information:"
End With
Else
MsgBox "Invalid CommandBar Name"
End If
End Sub
