Office中国论坛/Access中国论坛

标题: 在辅助说明菜单中加入自定义的命令按钮的方法 [打印本页]

作者: DIABL02NJ    时间: 2004-9-7 21:49
标题: 在辅助说明菜单中加入自定义的命令按钮的方法
<H3 >在辅助说明菜单中加入自定义的命令按钮

Sub AddHelpMenu()

    Dim cbrBar          As CommandBar

    Dim ctlCBarControl  As CommandBarControl

   

    ' Set a reference to the Help menu.

    Set cbrBar = CommandBars!Help

   

    ' If the My Help command already exists, delete it.

    For Each ctlCBarControl In cbrBar.Controls

        If ctlCBarControl.Caption = "&My Help" Then

            cbrBar.Controls("My Help").Delete

        End If

    Next

   

    ' Create a new CommandBarControl object on the Help menu

    ' and add a reference to it.

    Set ctlCBarControl = cbrBar.Controls.Add(Type:=msoControlButton)

   

    ' Set properties of the new command to display context-sensitive

    ' pop-up help. Set OnAction to call DisplayHelp procedure to display

    ' a help topic when clicked.

    With ctlCBarControl

        .Caption = "&目前日期时间"

        .BeginGroup = True

        .FaceId = 0

        .OnAction = "DisplayDateAndTime"

        .HelpFile = "sample.chm"

        .HelpContextId = 1000

        .Visible = True

    End With

End Sub
作者: chaojianan    时间: 2009-10-29 21:02
支持下,测试下。




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3