|
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 = "&My Help"
.BeginGroup = True
.FaceId = 0
.OnAction = "DisplayHelpXL"
.HelpFile = "sample.chm"
.HelpContextID = 1000
.Visible = True
End With
End Sub
或
Sub DisplayHelpXL()
Application.Help Currentproject.Path & "\sample.chm", 2001
End Sub |
|