ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom help attached to CommandButton (https://www.excelbanter.com/excel-programming/400645-custom-help-attached-commandbutton.html)

Wendy V

Custom help attached to CommandButton
 
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)

Peter T

Custom help attached to CommandButton
 
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

"Wendy V" wrote in message
...
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)





All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com