How to point to a specific help topic when invoking a help button vbMsgBoxHelpButton

When a certain contition is fullfiled I fire up a msg box

MsgBox msg_string, vbCritical + vbOKOnly + vbMsgBoxHelpButton, "Warning"

Now my question, there is the button
What actually happened when the users presses this button, can someone give me some lines of code
how to invoke a ceratin help ID when the user presses this button

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
Hi themroc,

When I include HTMLHelp with an app, I use this API function to enable the help launch:

Private Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, _
    ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long
' Use &HF for uCommand to display a help topic by ContextID (passed as dwData)

I will usually put a commandbutton each form to show help; the click event sub for that button will call
that API function and pass the context ID to show a specific topic.

To do this in a MsgBox:

MsgBox(prompt[, buttons] [, title] [, helpfile, context])


themrocAuthor Commented:
Hi patrick

I created already a help file and invoke it with
App.HelpFile = "help.chm"

When I want to display help for any topic I only have to assign a help ID and it goes to the right topic.
This I usually do in the property windo for a ceratin control

Now I am not quiet sure where I can set the help ID for the vbMsgBoxHelpButton

Lets say the helpContextID is 661, where do I have to set this number for this button?

MsgBox msg_string, vbCritical + vbOKOnly + vbMsgBoxHelpButton, "Warning"
Patrick MatthewsCommented:
It's the fifth argument.  See the syntax I posted above.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
themrocAuthor Commented:
Sorry I was a little bit slow,
it works fine thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.