View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sean Connolly[_3_] Sean Connolly[_3_] is offline
external usenet poster
 
Posts: 25
Default event with commandbar button right-click?

Hi,

Not so sure about right-click, but Office CommandBar controls (2k3) do have
..HelpFile and .HelpContextId properties that can be set. Look these up in the
Excel VBA help - where it also says that "Help topics respond to Shift+F1".

So maybe something like ...

With .Controls.Add(Type:=msoControlButton)
.Caption = "Open report (F3 OR O from the treeview)"
.OnAction = "OpenReport"
.FaceId = 23
.HelpFile = "C:\...\myHelpFile.hlp" ' Full path to your compiled help
file.
.HelpContextID = 69
' The topic ID number that has been correctly mapped to a topic in your
compiled help file.
End With

Don't know if this also works with HtmlHelp compiled help files (*.chm) or
not - I'm having my own set of problems with text-popup context-sensitive
help (see my other post) from HtmlHelp.

Trust this helps and let me know how you get on.

Cheers, Sean.

"RB Smissaert" wrote:

Would it somehow be possible to trigger an event on right-clicking a
commandbar button?

These buttons are created like this:

Public cb2 As CommandBar

Set cb2 = CommandBars.Add("MyOptionsPopUp", _
msoBarPopup, _
MenuBar:=False, _
temporary:=True)

With cb2
Set FileControl = .Controls.Add(Type:=msoControlPopup)
With FileControl
.Caption = "File"
With .Controls.Add(Type:=msoControlButton)
.Caption = "Open report (F3 OR O from the treeview)"
.OnAction = "OpenReport"
.FaceId = 23
End With

etc.


The purpose is to trigger context sensitive help on the menu.


RBS