Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compressing pictures (XP SP 1)

    Hello everybody!

    Actually, I am creating some tools for my company to make the preparation of a presentation easier. To make the additional functionality available, I have created a new submenu in the main menu (where you may find 'file', 'edit' and so on). Now I want to create one item which already may be found in the graphics-menubar (compressing pictures), since I have experienced this is very helpful, but nobody really knows about it. Creating the item is no problem, but filling the button with functionality is. I have no idea how to use integrated dialogs within PowerPoint, since the Dialogs-Collection from Word and Excel is non-existent in PowerPoint. Recording a macro while compressing a picture just showed selecting the picture I have compressed. Does anybody have an idea on this? Any help will be appreciated!

    Best regards, Porley

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

    Re: Compressing pictures (XP SP 1)

    Select Tools | Customize...
    You can copy the Compress Pictures button from the Picture toolbar to any other toolbar or to a menu by dragging and dropping it with the Control key held down.

    (Compressing pictures doesn't seem to be exposed in the VBA Object model for PowerPoint)

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compressing pictures (XP SP 1)

    Hello Hans!

    Thanks for the idea. It is true, I could handle it this way. But unfortunately it will not work in my case. The additional menu is created via VBA, and I have to place Compress Pictures button using VBA as well. Do you (or somebody else) know how this can be done with VBA? The macro recorder is no help there.

    Best regards, Porley

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

    Re: Compressing pictures (XP SP 1)

    A CommandBarButton has a method Copy, but it needs a CommandBar, i.e. a toolbar or menu bar as target, I don't see how you can specify a submenu as target.

    For example, the following instruction will copy the Compress Pictures button to a custom toolbar named My Tools:

    Application.CommandBars("Picture").Controls("Compr ess Pictures").Copy Bar:=Application.CommandBars("My Tools")

    Perhaps someone else will be able to tell you how to copy to a submenu.

  5. #5
    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: Compressing pictures (XP SP 1)

    By specifying the ID of the built-in control to the Add method, the control will be cloned onto your new menu:

    <code>Sub AddControlUsingID()
    ' Capture the ID of the control we want to copy
    Dim cbCtrlId As Long
    cbCtrlId = Application.CommandBars("Picture"). _
    Controls("&Compress Pictures...").Id
    ' Add a copy of the control to the testing submenu
    Dim cbCtrlDest As CommandBarControl
    Set cbCtrlDest = Application.CommandBars("Menu Bar"). _
    Controls("Help").Controls("TESTING"). _
    Controls.Add(Id:=cbCtrlId)
    ' Set any other relevant properties?
    ' Clean up objects
    Set cbCtrlDest = Nothing
    End Sub</code>

    It goes without saying that one might better structure this as a function and pass it the target control... but not tonight.

  6. #6
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compressing pictures (XP SP 1)

    Hello Jefferson!

    Thank you very much for this brilliant idea! It works perfectly!!!

Posting Permissions

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