Results 1 to 13 of 13
  1. #1
    Star Lounger
    Join Date
    Jun 2004
    Location
    Gtr London, England
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dialog Boxes in PowerPoint (Office 2003)

    Morning all

    Can anyone help ... please.

    In Word you can show the Microsoft Dialog boxes (ie Dialogs(wdDialogInsertPicture).Show) and wondered if the same options were available in PowerPoint. I would like to show the Insert Picture dialog box but cannot seem to find a way of doing this. The only dialog boxes available seem to be "Save as", "Open" etc.

    Many thanks
    Jack

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

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Except for Application.FileDialog to open or save a file, dialogs are not exposed in the PowerPoint object model. As a workaround, you can call the action of a menu option or toolbar button. To display the Insert Picture dialog, use

    CommandBars("Insert").Controls("Picture").Controls ("From File...").Execute

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Or, to make it international:

    Application.Commandbars("Menu Bar").FindControl(Id:=2619,Recursive:=True).Execut e
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Yes, that's better if you want to use the presentation on non-English language systems. Thanks!

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Just for your (and everyone else's) information:

    My xlmenufundict also has the list of Powerpoint menu items.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  6. #6
    Star Lounger
    Join Date
    Jun 2004
    Location
    Gtr London, England
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Thanks Jan

    Regards
    Jack

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Don't you hate it when these come back to haunt you 2 years later?
    I want to display the File, New Presentation dialog box in PowerPoint (2003) and I can't work out whether this is possible from VBA. Should be because there is such a dialog, and I have had a look at the xlMenuFunDict.xls file, but can't work out how to apply it.

    Can you help me please? Thank you.

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

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Unfortunately, the built-in dialogs are not exposed in PowerPoint VBA (except for the Open and Save dialogs, and even those are hidden and undocumented). You can use the FileDialog object to simulate it in a macro:

    Sub ShowTemplates()
    Dim strTemplate As String
    Dim prs As Presentation
    With Application.FileDialog(msoFileDialogFilePicker)
    .ButtonName = "New"
    .Title = "Templates"
    .Filters.Clear
    .Filters.Add "Templates", "*.pot"
    ' Substitute correct path
    .InitialFileName = _
    "C:Program FilesMicrosoft OfficeTemplatesPresentation Designs*.pot"
    If .Show = True Then
    strTemplate = .SelectedItems(1)
    Set prs = Presentations.Add
    prs.Slides.Add Index:=1, Layout:=ppLayoutTitle
    prs.ApplyTemplate strTemplate
    End If
    End With
    End Sub

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Thank you Hans. That works beautifully. Do you know if it's possible to do the same thing to Apply a Presentation Design to the current presentation? I imagine this would replace the (msoFileDialogFilePicker). Instead of using the TaskPane's Browse button.

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

    Re: Dialog Boxes in PowerPoint (Office 2003)

    You'd keep msoDialogFilePicker, but you'd apply the selected template to the active presentation instead of creating a new one:

    Sub ShowTemplates()
    Dim strTemplate As String
    With Application.FileDialog(msoFileDialogFilePicker)
    .ButtonName = "Apply"
    .Title = "Apply Design Template"
    .Filters.Clear
    .Filters.Add "Templates", "*.pot"
    ' Substitute correct path
    .InitialFileName = _
    "C:Program FilesMicrosoft OfficeTemplatesPresentation Designs*.pot"
    If .Show = True Then
    strTemplate = .SelectedItems(1)
    ActivePresentation.ApplyTemplate strTemplate
    End If
    End With
    End Sub

    (I changed the caption of the dialog and of the button to match the change in purpose)

  11. #11
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Thank you Hans. I haven't come across the msoFileDialogFilePicker command before, but I see it is very flexible.

    This does exactly what I wanted.

    I'm going to create an add-in to help us quickly select our own presentation design templates, and I assume that I will have to create the toolbar and buttons to access these controls, on the fly. Is it similar to how I would do it in Excel or are there some pitfalls I need to know about. In Excel we check whether the toolbar is or isn't there and if not create it with our customised buttons, as part of an autoexecute. PowerPoint isn't giving me any VBA context sensitive help, so I'm not finding it the easiest product to use.

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

    Re: Dialog Boxes in PowerPoint (Office 2003)

    See How can I get my code to run automatically when a presentation opens? and the links provided there - useful info about creating add-ins, toolbars etc.

  13. #13
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Dialog Boxes in PowerPoint (Office 2003)

    Thank you Hans. I'll digest this and I'm sure it will help. I'm definitely not going to make a career change though - I'll stick to Word if I can!

Posting Permissions

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