Custom help attached to CommandButton

W

Wendy V

Is it possible to attach a custom help file to a CommandButton embedded in an
excel sheet so that when the button takes focus and I press F1, my custom
help file pops up? I could not find the HelpContextID property for my
command button.

Wendy
(Excel 2003, WinXP Pro)
 
P

Peter T

Hi Wendy,

I don't think possible directly, at least not in the same way as in theory
possible with a control in a form.

You might try something like the following to detect if F1 was pressed while
the button was in focus, in the sheet module -

Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger,
ByVal Shift As Integer)
Const cHelpID as long = 1100 ' help constant ID
If KeyCode = vbKeyF1 then
Call myHTMLhelp(cHelpID)
end if
End Sub

where myHTMLhelp is your routine to call the HTML help API (assuming you are
not using WinHelp)

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top