Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Color Swatch Toolbar (2000+)

    Hi All,

    We produce documents that have text highlighted in different colors with different purposes throughout. Currently there are 5 different colors with different purposes.

    There is a legend that explains what the different colors mean. The problem is that the legend is just text (currently on page 6 but suggested to be moved to page 1).

    The problem is that when the reader scrolls past the legend, the reader might forget what a color means. You have to find the legend, wherever it is.

    What I would like to do is create a toolbar named, for example, "Color Legend". Simple enough.

    I would then like to add 5 (for now) boxes with the color swatch corresponding to the text coloring. Here is a first problem, at least from what I can see. Anything I add to a toolbar is an "active" control. For example, I can add a rectangle from the drawing items and color it. Problem is that if a reader clicks on this rectangle, he/she will be pushed into drawing mode for rectangles. Of course, I can tell them not to click but just hover but I'd prefer not to have to do that.

    I've also tried items from the Control Toolbar but that has the same problem.

    So the first question is whether there's some item to put on the toolbar that is totally inactive when clicked on - preferably in rectangular shape.

    Second issue, but relatively minor, is putting a "tool tip" associated with the rectangle. I can deal with that easily enough with the above rectangle by changing the &Name attribute of the toolbar item. I have NOT checked if there's a max # of characters that can be used here. Is there?

    Once the above is done, I can easily deal with the issue of getting the toolbar made available to all such documents.

    So I need some help with the above. If other solutions can be suggested, feel free to suggest. But a color legend in the text, as we have now, is not a desired solution.

    TIA.

    Fred

  2. #2
    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: Color Swatch Toolbar (2000+)

    I can't think of an inactive control for a toolbar (CommandBar), but you could have ordinary command buttons that do nothing but run a macro to write the same info as in the tooltip down on the Status Bar. This would not require the user to click OK. Or your macro could display a non-modal VBA UserForm for 2 seconds with the information...

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

    Re: Color Swatch Toolbar (2000+)

    You can create a toolbar with buttons in code. The buttons will have no action by default.
    See the attached document. The macro in the document was used to create the toolbar.
    Attached Files Attached Files

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Color Swatch Toolbar (2000+)

    Hi Hans and Jefferson,

    Thanks for the quick replies.

    Jefferson's suggestion could be a way and maybe it's similar to Hans' solution.

    Is there a reason why the macro associated with the button has to do anything - even in the status bar? If anything, can't it just delyay a few millisecs?

    I'm also thinking I wouldn't be able to reproduce the color on the status bar. I know creating a msg box with the meaning of the color requires an OK, so no good.

    I kind of like the idea of a non-modal form that says what the color means. It would allow a fuller explanation of what the color is than a tool tip. But doesn't the form still have to be closed or ok'ed?

    Jefferson's suggestion also made me think that maybe a button that says "show full legend" in a form might be useful.

    So some number of things to think about.

    HOWEVER, I WOULD PREFER NOT TO HAVE ANY MACROS BECAUSE OF THE USUAL ISSUE OF NOVICE USERS HAVING TO DEAL WITH THE MACRO WARNING. SEEMS LIKE ANY OF THE ABOVE REQUIRES A MACRO.

    So that brings me to Hans' solution. As I understood it, the macro in your document only created the toolbar. Once created, I can copy it from my "creation" document to some other document and there won't be any macros in the latter.

    But I didn't understand how the buttons were being created. Focusing on just one button (green), there are 5 statements per button:
    - I understand the .Caption statement but where does the color swatch come from? I'm assuming not this statement.
    - .TooltipText should be obvious. But I changed one, recompiled, even closed and reopened the doc. While my change is still in the VBA after reopen, the tooltip still has the original info ("Green as the grass in spring")
    - .Style is obvious - gives me an icon AND caption as part of the button. I might just want the icon and color meaning show just when the button is hovered over. But having the caption even removes the need to hover. Something to think on. Makes the toolbar busier but removes the need to hover.
    - MsgBox: I understand what this does in general but I never got a msg box
    - . PasteFace: what is this doing? If this is related to the colored box part of the button, how is the real color determined since there is no color designation as part of this statement? If the color determination is part of the .Caption statement, where would I find the official names of colors so I can create colors corresponding to what we use?

    ** One question I asked but didn't see an answer is how long can the &Name be? I used relatively short names but that might be too cryptic to explain the meaning of the color.

    Thanks again.

    Fred

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

    Re: Color Swatch Toolbar (2000+)

    Once you have run the code, you can throw away the macro. The user doesn't need it.

    If you want to run it again, with or without any changes, you must throw away the "Color Bar" toolbar first (in Tools | Customize, or add a line to the code).

    The purpose of the MsgBox statements is to pause the code during the macro that creates the toolbar. This gives you time to copy the correct color to the clipboard, for example in Paint or in any other graphics program. When you click OK, the code will paste the color onto the button currently being modified.

    Why don't you experiment with different length texts? You'll find out soon enough what the maximum length is.

  6. #6
    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: Color Swatch Toolbar (2000+)

    <hr>I kind of like the idea of a non-modal form that says what the color means. It would allow a fuller explanation of what the color is than a tool tip. But doesn't the form still have to be closed or ok'ed?<hr>
    You can code a non-modal (modeless) UserForm to close itself after an event or after enough time passes. I've used it for "please wait" messages as I did stuff to the document, for example.

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Color Swatch Toolbar (2000+)

    Hi Fred,

    Wouldn't it be easy to edit your document in split-screen mode, with, say, the upper portion showing your legend? That way you can scroll the other window up/down without ever losing sight of the legend. No code, nada.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #8
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Color Swatch Toolbar (2000+)

    Hi Macropod,

    Great idea. I'm not sure if the skill set of people we provide these documents for would know about the split feature. I've rarely use it myself since it takes away screen space from the main window. Our color code occupies 5 lines. I would also want to see if there's a way to have the split available and correctly positioned when the document is opened and without code.

    Let me explore this. Great idea.

    Thanks.

    Fred

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Color Swatch Toolbar (2000+)

    Hi Hans,

    Thanks for the help.

    I didn't have a lot of time to find what the max tooltip length is. My longest one was about 50 characters and that was fine. I tried googling "maximum tooltip" and saw something that suggested 80 characters but I didn't have a lot of time to read the article so I'm not sure.

    I did create the toolbar in your file (after deleting your sample toolbar). Then I transferred it to my document and it works fine. The only problem I ran into was creating the little swatches in Paint (I very very rarely use Paint); I ended up using IrfanView. I also added a control with no swatch and just a caption (msoButtonCaption or something like that) saying "Color Explanation: hover over the color".

    Fred

Posting Permissions

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