Results 1 to 9 of 9
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Assigning What's This Help Text to a Custom Menu (Word 2000)

    I've looked through the help, but can't figure this one out. I've created a custom menu in a template, which I then attach to documents. If I Go to Word's Built-in Help menu, click What's This, and then click one of these custom menu options, I get the message:

    Custom

    Runs an add-in program or a custom macro.

    1. How do customize this text? If I can customize it, can I add hyperlinks or just simple text?

    2. Is it possible to have What's This Help bring up an HTML Help topic instead? I have RoboHelp from which I can create the HTML Help. It would be nice to display it in the same window used by Word and VBA help.

    Thanks!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    I can't answer your question completely, since I'm still using Office 97 (which uses Windows .hlp help files, not HTML help), but hopefully the following can be adapted for Office 2000.

    In Office 97, toolbar buttons and menu options are objects of type CommandBarButton. They have properties that can be set in VBA, such as:

    <table border=1><td>Property</td><td>Type</td><td>Description</td><td>HelpFile</td><td>String</td><td>Path and file name of the help file
    associated with the button/menu item</td><td>HelpContextID</td><td>Long Integer</td><td>ID of help topic in the help file</td></table>
    Example:

    Sub SetProperties()
    Dim cbr As CommandBar
    Dim ctl As CommandBarButton
    Set cbr = CommandBars("TestMenu")
    Set ctl = cbr.Controls(1)
    With ctl
    .Caption = "Click Here"
    .TooltipText = "This is a test of the emergency broadcast system"
    .HelpFile = "C:MyFilesMyHelp.hlp"
    .HelpContextID = 123456
    End With
    Set cbr = Nothing
    Set ctl = Nothing
    End Sub

    As I mentioned, this is for Office 97, but I'm sure Office 2000 will have similar properties that relate to HTML help. Look up CommandBarButton in the VBA help, or in the Object Browser (type F2 in the Visual Basic Editor to display the Object Browser, and type CommandBarButton in the Search box).

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    No matter how I try to do it, the approach you gave will only let me access the top level custom menu, not any of the items therein.

    For example, on the menu bar, just to the right of the Help menu, I have a menu called "Test" with submenu "SubTest" with menu item "Item1".

    The only thing it will recognize as a CommandBar is "Menu Bar".
    The only thing it will recognize as a Control is "Test".
    I can't get it recognize any of the pieces of this as a CommandBarButton.

    I just get "Invalid procedure call or arguement" or "Type mismatch" errors.

    Any ideas?

    Thanks!!
    Troy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    Code like this should work (the actual help file and help context ID are for Office 97, so it needs to be adapted):

    With CommandBars("Menu Bar").Controls("Test").Controls("SubTest").Control s("TestItem")
    .Caption = "Another Caption"
    .TooltipText = "This is my tooltip text"
    .HelpFile = "C:Program FilesMicrosoft OfficeOfficeOfTip8.hlp"
    .HelpContextID = 18866177
    End With

  5. #5
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    Even with this new code I still get an "Invalid procedure call or argument" error.

    Anything else we can try?

    Thanks!!
    Troy

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    I'm out of ideas now. Anyone with Word 2000 who has experience with this?

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    We're all going to kick ourselves: that error call arises because after you run the procedure once, the control index changes from "TestItem" to "Another Caption." Try it without changing the caption again:

    <pre>With CommandBars("Menu Bar").Controls("Test").Controls("SubTest").Control s("Another Caption")
    '.Caption = "Another Caption"
    .TooltipText = "This is my tooltip text"
    .HelpFile = "C:Program FilesMicrosoft OfficeOffice1033OfTip9.hlp"
    .HelpContextId = 18866177
    End With</pre>

    Unfortunately, although this works perfectly with "What's This" help, I couldn't figure out a way to access the Tooltip (I think it is suppressed for menu controls, as opposed to toolbar controls).

  8. #8
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    Finally found the problem with accessing the sub menu items. I'd looked at things so many times, but I still missed a typo in my menu item name <img src=/S/newbrain.gif border=0 alt=newbrain width=21 height=22>. (I had not previously gotten to the point of renaming the caption.)

    Any ideas on how to tie this to the HTML Help in Word or is that just too much to ask? Or perhaps it's just a matter of assigning the map ID to a topic in an HTML Help project?

    Thanks for the help!!
    Troy

  9. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Assigning What's This Help Text to a Custom Menu (Word 2000)

    I downloaded the Help Workshop from MSDN but never played with it, so I really have no clue about how to link the topics. Was just playing with the code here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •