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

Posted on 2006-03-28
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
    LVL 92

    Expert Comment

    by:Patrick Matthews
    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

    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 92

    Accepted Solution

    It's the fifth argument.  See the syntax I posted above.

    Author Comment

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

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    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…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now