Access交流中心

北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |

用户定义类型未定义错误

阳阳  发表于:2014-04-11 13:45:29  
复制

请教各位老师,我在论坛复制一段代码“

Function CBPrintCBarInfo(strCBarName As String) As Variant

    ' This procedure prints (to the Debug window) information

    ' about the command bar specified in the strCBarName argument

    ' and information about each control on that command bar.

    Dim cbrBar                      As CommandBar

    Dim ctlCBarControl              As CommandBarControl

    Const ERR_INVALID_CMDBARNAME    As Long = 5

   On Error GoTo CBPrintCBarInfo_Err

    Set cbrBar = Application.CommandBars(strCBarName)

   Debug.Print "CommandBar: " & cbrBar.Name & vbTab & "(" _

        & CBGetCBType(cbrBar) & ")" & vbTab & "(" _

        & IIf(cbrBar.BuiltIn, "Built-in", "Custom") & ")"

    For Each ctlCBarControl In cbrBar.Controls

        Debug.Print vbTab & ctlCBarControl.Caption & vbTab & "(" _

            & CBGetCBCtlType(ctlCBarControl) & ")"

    Next ctlCBarControl

CBPrintCBarInfo_End:

    Exit Function

CBPrintCBarInfo_Err:

    Select Case Err.Number

        Case ERR_INVALID_CMDBARNAME

            CBPrintCBarInfo = "'" & strCBarName & _

                "' is not a valid command bar name!"

        Case Else

            CBPrintCBarInfo = "Error: " & Err.Number _

                & " - " & Err.Description

    End Select

    Resume CBPrintCBarInfo_End

End Function

运行时出错 ”用户定义类型未定义”

Private Sub Command0_Click()

      CBPrintCBarInfo(“Web”)

End sub

为什么会出现错误呢?是什么东东没引用?,请教了,谢谢!!!

 

Top
总记录:0篇  页次:0/0 9 1 :