• RoboHelp and VBA (2000)

    Author
    Topic
    #404359

    Hi,

    Is it possible to attach a RoboHelp project to a VBA (not VB) project? That is, I don’t have standalone VB, but I do have Word 2000 with all the VBA tools. I want to create a form with VBA and then put some context sensitive help behind it using RoboHelp.

    Thanks,
    Bob

    Viewing 2 reply threads
    Author
    Replies
    • #821973

      While the forms engines used in VBA and in VB are different, I suspect that they call into Windows help files in a similar manner. But I haven’t tried it myself.

    • #822429

      I have just been doing this very thing with WinHelp. I am not familiar with RoboHelp, but can tell you how to do it and hopefully you can fill in any blanks?

      First, I opened the VBA project and associated a help file with it.

      • Right-click on the project
      • Choose Project Properties
      • Type the full path to the help file (you can type in a filename that doesn’t yet exist — if you want to browse to it, it has to exist…)
      • Select the main form (or each form in the project) — make sure you have the form itself and not a control on the form
      • Find the form properties WhatsThisButton and WhatsThisHelp. Change WhatsThisButton to True — this should automatically change WhatsThisHelp to True. They both need to be set to true. This will cause the What’s This? question mark to appear on the form.
      • For each control on the form(s) that will have context-sensitive text, find the control’s HelpContextID property and assign a number (you can assign the same number to more than one control if the help text will be the same)
      • Save the project
        [/list]Next, I wrote the help topics and created an include file that linked each topic to an ID:
        #define IDH_topicOne 1000
        #define IDH_topicTwo 1010… and so on

        After making certain the *.hlp file was in the right location, I tested the form. Success!

        You need a WinHelp file (*.hlp) to connect context-sensitive help in Word VBA — HTMLHelp (*.chm) doesn’t work. I’ve read that it works with Excel and PowerPoint (go figure), but HTMLHelp has plain vanilla context pop ups — no formatting or bitmaps or font attributes or anything unless RoboHelp has an alternative method of doing that.

        Hope this helps you with your RoboHelp files…

        Kim

      • #840415

        Kim,

        Thanks for your procedure–it gave me some more insight into my own project. Since my first post, I’ve installed the standalone VB6. Also, I’m using HTML help. You say that doesn’t work with VBA; I’m wondering if I’ll have better luck with standalone VB6.

        I have the include file that you mention–it’s the map file that RoboHelp generated. Where in the VB project should I include it?

        Also, here is the code that RoboHelp says will connect VB and RH (some RH add-ins to VB also are involved):

        Public cshObject as new RoboHelp_CSH ‘Should be global object

        cshObject.RH_ShowHelp me.HWMD, strPathAndWindow (points to *.chm file), cshObject.HH_HELP_CONTEXT, topic number

        I’ve tried the variable declaration and the object.method in several places, but the best I can do is bring up the VB form–not the RH file–which confuses me. Would you have any idea what I can do here?

        Thanks,
        Bob

        • #840483

          Hi Bob,

          I should have been more precise. VBA doesn’t support context sensitive help natively. I now believe you can call context sensitive topics from HTML projects from VBA if you use the WinAPI. (It looks as if RoboHelp has a method for calling, too. About that I know nothing.)

          Since I wrote that reply, I’ve had a little more experience myself. However, my primary development computer has fallen ill and will be in the hospital for a couple of days undergoing tests. I will happily post all the code I have once I’ve restored it to my secondary computer later today.

          In the meantime, you only need an include file when compiling the *.hlp or *.chm file — you won’t need to reference it in your VB project. What you will need is a list of the topic ID numbers to plan to use in your form and/or code. I will have more for you later.

          Kim

        • #840484

          Hi Bob,

          I should have been more precise. VBA doesn’t support context sensitive help natively. I now believe you can call context sensitive topics from HTML projects from VBA if you use the WinAPI. (It looks as if RoboHelp has a method for calling, too. About that I know nothing.)

          Since I wrote that reply, I’ve had a little more experience myself. However, my primary development computer has fallen ill and will be in the hospital for a couple of days undergoing tests. I will happily post all the code I have once I’ve restored it to my secondary computer later today.

          In the meantime, you only need an include file when compiling the *.hlp or *.chm file — you won’t need to reference it in your VB project. What you will need is a list of the topic ID numbers to plan to use in your form and/or code. I will have more for you later.

          Kim

        • #840734

          Hi again,

          I re-read my post and still think I wasn’t accurate. Sorry. That’s what I get for hurrying.

          You shouldn’t need an include file at all. *I* needed one to compile my help file — it assigned topic ID for reference in VB/VBA. I assume RoboHelp automatically or interactively assigns topic IDs.

          Anyway, Click here to visit Paul O’Rear’s site that was so helpful to me.

          I used parts of his HelpAPI.bas file (a link is near the bottom of the page) to call HTML help from my VBA forms. I used a combo of WinHelp pop-ups (supports graphics) and HTMLHelp (when presenting the entire Help file). I’ve been using a very competent program called HelpScribble which lets me compile both *.hlp and *.chm from the same source.

          My forms are coded to look to the *.hlp file to display “What’s This?” help and command buttons call the *.chm file using HelpAPI. The code in your post looks a lot like the WinAPI calls, so there may be something to learn there.

          You mentioned “some RH add-ins to VB” and I’m assuming those were “references” to the RH *.dll. Bear in mind that using RH’s library means you will probably need install it on every pc running your help.

          To test it, do this: In the VB project, create a module and put the Public declaration in that.

          In the form, tie the command with an event of some kind (like clicking a command button). I believe the second parameter in the statement ought to be me.HWND which provides the Windows “handle” for the VB form (“me”).

          Now run the form and click the button to see if this displays the help you want.

          If it still doesn’t, perhaps you can post some of your code (all sanitized) so we can scrutinize further?

          If it does work, then all we need to do is figure out how to make it appear in a pop-up. grin

          Kim

          • #842749

            Hi,

            I’ve attached my Visual Basic project, along with a RoboHelp add-in class module (RoboHelp_Csh.cls), the map file generated by RoboHelp (BSSCDefault.h), and the compiled RoboHelp file (MHC_Online_Help_Prototype.chm). There seem to be three open issues:

            — How should the Declarations be set up? It looks like the RoboHelp_Csh.cls file is taking care of this, but I’m not sure.

            — How is connection made between VB fields and RH topics? In the HelpContextID property of text boxes, I’ve entered the same number as the number that RH assigned to the corresponding topic in the map file. It seems like there should also be some kind of call between RH and VB.

            — How are help topics called from fields? In the Click event of the Notification field, I entered a call to help, based on syntax provided by RH Help. I got run-time error 424 (Object required).

            The RH add-ins were the RoboHelp_Csh.cls file and a reference to Microsoft Internet Controls (Project > References).

            Thanks for the reference to the Paul O’Rear site–it helped simplify the problem. Most of my VB experience is with Word macros, so any help is really appreciated.

            Bob

          • #842750

            Hi,

            I’ve attached my Visual Basic project, along with a RoboHelp add-in class module (RoboHelp_Csh.cls), the map file generated by RoboHelp (BSSCDefault.h), and the compiled RoboHelp file (MHC_Online_Help_Prototype.chm). There seem to be three open issues:

            — How should the Declarations be set up? It looks like the RoboHelp_Csh.cls file is taking care of this, but I’m not sure.

            — How is connection made between VB fields and RH topics? In the HelpContextID property of text boxes, I’ve entered the same number as the number that RH assigned to the corresponding topic in the map file. It seems like there should also be some kind of call between RH and VB.

            — How are help topics called from fields? In the Click event of the Notification field, I entered a call to help, based on syntax provided by RH Help. I got run-time error 424 (Object required).

            The RH add-ins were the RoboHelp_Csh.cls file and a reference to Microsoft Internet Controls (Project > References).

            Thanks for the reference to the Paul O’Rear site–it helped simplify the problem. Most of my VB experience is with Word macros, so any help is really appreciated.

            Bob

            • #843055

              Hi Bob,

              I haven’t had a chance yet to look at your files (on-going computer hoo-doo, I’m afraid). However, I seem to have a little time before the next malfunction, so I will take a look at what you’ve sent. I’ll get back to you soon.

              Kim

            • #843056

              Hi Bob,

              I haven’t had a chance yet to look at your files (on-going computer hoo-doo, I’m afraid). However, I seem to have a little time before the next malfunction, so I will take a look at what you’ve sent. I’ll get back to you soon.

              Kim

            • #845159

              Mr Bob, Mr Bob!

              I’ve got it now. The thing that was keeping us from creating an object was that the public declaration:

              Public cshObject As New RoboHelp_CSH

              …needs to be in a module, not the class module. Add a module to your project, and put this code in the module. Remove it from the class module.

              Now save and run your project, and click on the one control to which you’ve added a click event — the help file should appear.

              Now, about creating a way to get help when you want it rather than having it pop up every time you click in a field, there’s some info out there.

              See, for example, Shadow Mountain Tech’s articles on programming context sensitive help.

              According to RoboHelp (yes, I installed the trial version to check!), What’s This Help (using the question mark) from an HTML help file is not available to VB programs — only C++ and C#. Further, it is text-only What’s This? help. If you want to use What’s This help for a VB Project, you must create a WinHelp file.

              I hope this helps — it certainly answers your initial question about why you were getting the error message about the object!

              Kim grin

            • #845480

              Kim,

              Setting up a module really helped. Also, I was able to get F1 field help using this new module and the Don Lammers article on HTML/Visual Basic in the Shadow Mountain web site that you recommended. Interestingly, RoboHelp recommended the class module that originally had the public declaration.

              That was the main obstacle to setting up a demo of the system–now I don’t have to think about this 24 hours a day. Thanks for taking such a strong interest in my project. thankyou

              Bob

            • #845501

              Bob,

              You’re welcome. I have received a lot of help from this forum and it’s always been terrific. Also, in addressing your issues, I managed to understand more about my own stuff. So I feel I win, too. I’m so glad you can relax now!

              K

            • #845502

              Bob,

              You’re welcome. I have received a lot of help from this forum and it’s always been terrific. Also, in addressing your issues, I managed to understand more about my own stuff. So I feel I win, too. I’m so glad you can relax now!

              K

            • #845481

              Kim,

              Setting up a module really helped. Also, I was able to get F1 field help using this new module and the Don Lammers article on HTML/Visual Basic in the Shadow Mountain web site that you recommended. Interestingly, RoboHelp recommended the class module that originally had the public declaration.

              That was the main obstacle to setting up a demo of the system–now I don’t have to think about this 24 hours a day. Thanks for taking such a strong interest in my project. thankyou

              Bob

            • #845160

              Mr Bob, Mr Bob!

              I’ve got it now. The thing that was keeping us from creating an object was that the public declaration:

              Public cshObject As New RoboHelp_CSH

              …needs to be in a module, not the class module. Add a module to your project, and put this code in the module. Remove it from the class module.

              Now save and run your project, and click on the one control to which you’ve added a click event — the help file should appear.

              Now, about creating a way to get help when you want it rather than having it pop up every time you click in a field, there’s some info out there.

              See, for example, Shadow Mountain Tech’s articles on programming context sensitive help.

              According to RoboHelp (yes, I installed the trial version to check!), What’s This Help (using the question mark) from an HTML help file is not available to VB programs — only C++ and C#. Further, it is text-only What’s This? help. If you want to use What’s This help for a VB Project, you must create a WinHelp file.

              I hope this helps — it certainly answers your initial question about why you were getting the error message about the object!

              Kim grin

        • #840735

          Hi again,

          I re-read my post and still think I wasn’t accurate. Sorry. That’s what I get for hurrying.

          You shouldn’t need an include file at all. *I* needed one to compile my help file — it assigned topic ID for reference in VB/VBA. I assume RoboHelp automatically or interactively assigns topic IDs.

          Anyway, Click here to visit Paul O’Rear’s site that was so helpful to me.

          I used parts of his HelpAPI.bas file (a link is near the bottom of the page) to call HTML help from my VBA forms. I used a combo of WinHelp pop-ups (supports graphics) and HTMLHelp (when presenting the entire Help file). I’ve been using a very competent program called HelpScribble which lets me compile both *.hlp and *.chm from the same source.

          My forms are coded to look to the *.hlp file to display “What’s This?” help and command buttons call the *.chm file using HelpAPI. The code in your post looks a lot like the WinAPI calls, so there may be something to learn there.

          You mentioned “some RH add-ins to VB” and I’m assuming those were “references” to the RH *.dll. Bear in mind that using RH’s library means you will probably need install it on every pc running your help.

          To test it, do this: In the VB project, create a module and put the Public declaration in that.

          In the form, tie the command with an event of some kind (like clicking a command button). I believe the second parameter in the statement ought to be me.HWND which provides the Windows “handle” for the VB form (“me”).

          Now run the form and click the button to see if this displays the help you want.

          If it still doesn’t, perhaps you can post some of your code (all sanitized) so we can scrutinize further?

          If it does work, then all we need to do is figure out how to make it appear in a pop-up. grin

          Kim

      • #840416

        Kim,

        Thanks for your procedure–it gave me some more insight into my own project. Since my first post, I’ve installed the standalone VB6. Also, I’m using HTML help. You say that doesn’t work with VBA; I’m wondering if I’ll have better luck with standalone VB6.

        I have the include file that you mention–it’s the map file that RoboHelp generated. Where in the VB project should I include it?

        Also, here is the code that RoboHelp says will connect VB and RH (some RH add-ins to VB also are involved):

        Public cshObject as new RoboHelp_CSH ‘Should be global object

        cshObject.RH_ShowHelp me.HWMD, strPathAndWindow (points to *.chm file), cshObject.HH_HELP_CONTEXT, topic number

        I’ve tried the variable declaration and the object.method in several places, but the best I can do is bring up the VB form–not the RH file–which confuses me. Would you have any idea what I can do here?

        Thanks,
        Bob

    • #822430

      I have just been doing this very thing with WinHelp. I am not familiar with RoboHelp, but can tell you how to do it and hopefully you can fill in any blanks?

      First, I opened the VBA project and associated a help file with it.

      • Right-click on the project
      • Choose Project Properties
      • Type the full path to the help file (you can type in a filename that doesn’t yet exist — if you want to browse to it, it has to exist…)
      • Select the main form (or each form in the project) — make sure you have the form itself and not a control on the form
      • Find the form properties WhatsThisButton and WhatsThisHelp. Change WhatsThisButton to True — this should automatically change WhatsThisHelp to True. They both need to be set to true. This will cause the What’s This? question mark to appear on the form.
      • For each control on the form(s) that will have context-sensitive text, find the control’s HelpContextID property and assign a number (you can assign the same number to more than one control if the help text will be the same)
      • Save the project
        [/list]Next, I wrote the help topics and created an include file that linked each topic to an ID:
        #define IDH_topicOne 1000
        #define IDH_topicTwo 1010… and so on

        After making certain the *.hlp file was in the right location, I tested the form. Success!

        You need a WinHelp file (*.hlp) to connect context-sensitive help in Word VBA — HTMLHelp (*.chm) doesn’t work. I’ve read that it works with Excel and PowerPoint (go figure), but HTMLHelp has plain vanilla context pop ups — no formatting or bitmaps or font attributes or anything unless RoboHelp has an alternative method of doing that.

        Hope this helps you with your RoboHelp files…

        Kim

    Viewing 2 reply threads
    Reply To: RoboHelp and VBA (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: