Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Lounger
    Join Date
    Nov 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Custom toolbar (W2000 9.0 3821 SR-1)

    Hello:
    Is there a way to create a new button image from an existent
    face id and then
    save it with a brand new ID so it will become available for anybody using
    your attached template (not an AddIn template). It has to be done manually
    it seems there is no way to do this via code(in an attached template) I
    altered an existent button image- works on my machine by obviously doesn't
    on anybody else. Again I am talking about an attached template where no
    Auto..() code is instantiated when attaching the template so I can't do it
    programmatically.
    Also I am using Word as a COM and open Word via its COM
    interface. For some reasons my customize toolbar (added manually) doesn't
    show up but all my shortcut menus (added manually) do show up. Any ideas?
    Thanks,
    Mihail

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    Charles Kenyon has an add-in on his site called FaceID, which contains all the button ID numbers. I'm not sure if he collected it from elsewhere or modified it. In any event, check it out here
    Cheers,

  3. #3
    New Lounger
    Join Date
    Nov 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    Thanks Phil. How can you add or modify a button so you can use it (shows up in FaceID)?

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

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    Add a reference to the Microsoft Office 9.0 Object Library in Tools/References...

    Now, you can create and control command bars (=menu bars, toolbars, popup menus) and command bar controls in code, for example:
    <UL><LI>The Controls property of a CommandBar object has an Add method that you can use to create new controls (buttons, dropdown lists, ...).
    <LI>To find a specific control on a command bar, you can use the FindControl method of the CommandBar object.
    <LI>The CommandBarControl object has methods CopyFace and PasteFace.[/list]Look these terms up in the online help to learn more about them.

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    I don't know that you can add to that, but to modify a button in Word:
    1. Bring up the Tools/Customize... dialog box.
    2. Right click on a button & the option to copy, edit, change, etc. should appear.

    As far as getting the ID number for a button, that you create, I have to leave that to one of the VBA experts.

    Hope this helps.

  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: Custom toolbar (W2000 9.0 3821 SR-1)

    > For some reasons my customize toolbar (added manually) doesn't
    > show up but all my shortcut menus (added manually) do show up. Any ideas?

    Word merge the normal and customized toolbars together, so it is safest if you create a completely new, custom toolbar. As long as it is visible in your template, it should be visible when attached to a document.

  7. #7
    New Lounger
    Join Date
    Nov 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    Thank you very much for all your replies - they have been very helpful. One question still remains:
    I change a button image (manually) and save it. E.g. 123 - smiley face to sad face. The face ID REMAINS the same - e.g. 123. On somebody else machine 123 is STILL a smiley face on mine is not. My point is that the change is local. Any way to "export" the changed button(or a newly created one)?
    Thanks,
    Mihail

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    The easiest way to do this is to have all the faces you want on a custom toolbar that is part of your template.

    StuartR

  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: Custom toolbar (W2000 9.0 3821 SR-1)

    Stuart,

    I'm familiar with editing face-ids. I think the suggestion further up on this thread to use Charles Kenyon's add-in still deals with the standard face-ids that MS supplies.

    I'm not sure if I understand your last answer
    >have all the faces you want on a custom toolbar that is part of your template

    I know you can have the face-id numbers for the custom toolbar in your template - I do it in Excel. But face id 837 in the template still points to whatever MS supplied for face #837. But after having edited it, how do you capture the image in your template. I think that's what was being asked and I'd sure like to know.

    Fred

  10. #10
    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: Custom toolbar (W2000 9.0 3821 SR-1)

    I think what Stuart is saying is to add to your template a custom toolbar of (otherwise pointless) buttons whose sole purpose is to provide a container for your customized button faces. Then use CopyFace and PasteFace (I think those are the names) to put the hidden faces on the custom toolbar where you want them to appear.

  11. #11
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    > I think what Stuart is saying is...

    You think right, that is what I meant to say.

    StuartR

  12. #12
    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: Custom toolbar (W2000 9.0 3821 SR-1)

    Stuart,

    Thanks to you and Jefferson for clarifying but...

    I think what Mihail was asking for, and what a friend of mine just asked is the following: I can create code that adds toolbars and buttons as such (taken from Excel but I don't think it matters)

    <pre> Set cBar = CommandBars.Add("Picture Control", msoBarTop)
    'This puts the Toolbar above the workbook.
    With cBar
    .Controls.Add(Type:=1).Caption = "Insert Pictures"
    .Controls.Add(Type:=1).Caption = "Delete Pictures"
    .Visible = True
    .Controls(1).OnAction = "RunInsertPicture"
    .Controls(1).FaceId = 59
    .Controls(2).OnAction = "deleteshapes"
    .Controls(2).FaceId = 536
    End With
    </pre>


    I gave this code to my friend. He had created added some buttons to a toolbar. And then copy/pasted button images to the buttons after editing them from some other buttons. I understand how to do this manually while in Customize mode in Word or Excel.

    However, suppose the above code is run when a document is open. How would you get the edited button image onto button 1 or 2? The faceId refers to the standard image per Excel/Word/Office. I told my friend not to worry about the actual image on the button; if he didn't like the image, just pick a different number. The image should be the least of his worries. But the question still remains...how to get a customized image onto a button using VBA?

    Fred

  13. #13
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Custom toolbar (W2000 9.0 3821 SR-1)

    Fred,

    Where is the edited button image at the time you want to use it? Is it on your computer, or your friends? You should be able to access it using CopyFace.

    StuartR

  14. #14
    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: Custom toolbar (W2000 9.0 3821 SR-1)

    If you mean, have we been hiding the

    CommandBars.ButtonFaces.Add(Key:=Long, Data:=BinaryPictureData, File:=FileSpec)

    method from you, no, we haven't, there's no such thing in the Office 2000 object model. You really are stuck using the CopyFace and PasteFace method. Crappy, isn't it?

  15. #15
    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: Custom toolbar (W2000 9.0 3821 SR-1)

    >Crappy, isn't it?

    YES!


    >CommandBars.ButtonFaces.Add(Key:=Long, Data:=BinaryPictureData, File:=FileSpec)

    Exactly what I wanted. <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>


    >You really are stuck using the CopyFace and PasteFace method

    so can't do anything automatically in VBA to customize faces when creating my own toolbar and adding buttons

    Fred

Page 1 of 2 12 LastLast

Posting Permissions

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