Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2006-03-28
Medium Priority
Last Modified: 2010-04-07
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

Question by:themroc
  • 2
  • 2
LVL 93

Expert Comment

by:Patrick Matthews
ID: 16309794
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])



Author Comment

ID: 16310392
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"
LVL 93

Accepted Solution

Patrick Matthews earned 500 total points
ID: 16310917
It's the fifth argument.  See the syntax I posted above.

Author Comment

ID: 16311028
Sorry I was a little bit slow,
it works fine thank you

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question