none
Save as - dialog window

    Question

  • Hi gents,

    I am trying to display a "Save as" file dialog window from my vba code. Everything works good except for the fact that the dialog window does not offer advanced options, that is: 'Open file after publishing', 'Standard' and 'Minimum Size'.

    

    I leave my code here:

    Dim FileDialog As Office.FileDialog
    
    Set FileDialog = Application.FileDialog(msoFileDialogSaveAs)
    
    With FileDialog
                .Title = "Save As..."
                .InitialFileName = Left(ActivePresentation.Name, InStr(1, ActivePresentation.Name, Chr(46), vbTextCompare) - 1) 'Chr(46)='.'
                .AllowMultiSelect = False
    
                If .Show = OK Then
                    .Execute
                End If
    End With
    

    Thank you very much in advance. BR, FoNs.

    • Edited by My Sharona Thursday, February 09, 2012 8:45 AM
    Wednesday, February 08, 2012 5:45 PM

Answers

  • You're correct - as far as I know it is not possible to display the Save As dialog with all options from VBA in PowerPoint.

    Regards, Hans Vogelaar

    • Marked as answer by My Sharona Tuesday, February 14, 2012 11:19 AM
    Thursday, February 09, 2012 12:21 PM
  • My Sharona

    The feature that you are looking for is called ".ExportAsFixedFormat Method"

    Though you cannot display that in the File Dialog but you can create your own file dialog with those option buttons and then in the save as routine pass the relevant values for example the syntax is

    expression.ExportAsFixedFormat(Path, FixedFormatType, Intent, FrameSlides, HandoutOrder, OutputType, PrintHiddenSlides, PrintRange, RangeType, SlideShowName, IncludeDocProperties, KeepIRMSettings)

    The FixedFormatType takes the values for those option buttons.

    For Standard(publishing online and printing), the value of FixedFormatType is ppFixedFormatIntentPrint and

    For Minimize size(publishing online), the value of FixedFormatType is ppFixedFormatIntentScreen which is the default.

    For more info on .ExportAsFixedFormat, please see the below link.

    Topic: Presentation.ExportAsFixedFormat Method

    Link: http://msdn.microsoft.com/en-us/library/bb231096%28v=office.12%29.aspx




    Sid (A good exercise for the Heart is to bend down and help another up) Please do not email me your questions. I do not answer questions by email unless I get paid for it :) If you want, create a thread in VB.Net/Excel forum and email me the link and I will help you if I can.

    • Marked as answer by My Sharona Tuesday, February 14, 2012 11:19 AM
    Thursday, February 09, 2012 2:29 PM
    Moderator

All replies

  • You have posted this in the Excel for Developers forum, but your question appears to be about PowerPoint.

    The FileDialog doesn't execute anything, it lets the user select a file or folder or specify a file name.

    It is a generic Office dialog, without specific PowerPoint extensions.

    Unfortunately, the PowerPoint-specific Save As dialog is not available in VBA.

    Here is a working version of your code (but not specific to PowerPoint):

    Sub MySaveAs()
        With Application.FileDialog(2) ' msoFileDialogSaveAs
            .InitialFileName = Left(ActivePresentation.Name, InStr(ActivePresentation.Name, ".") - 1)
            .AllowMultiSelect = False
            If .Show Then
                ActivePresentation.SaveAs FileName:=.SelectedItems(1)
            End If
        End With
    End Sub


    Regards, Hans Vogelaar

    Wednesday, February 08, 2012 8:07 PM
  • Hi Mark,

    thank you very much for your answer. You are right, my code is leaded to a power point application, but since you can also find the Save As dialog with advanced options in Excel, I decided to put it in this forum.

    First of all, sorry because I wrote my code badly, so it actually is:

    Dim FileDialog As Office.FileDialog
    
    Set FileDialog = Application.FileDialog(msoFileDialogSaveAs)
    
    With FileDialog
                .Title = "Save As..."
                .InitialFileName = Left(ActivePresentation.Name, InStr(1, ActivePresentation.Name, Chr(46), vbTextCompare) - 1) 'Chr(46)='.'
                .AllowMultiSelect = False
    
                If .Show = OK Then
                    .Execute
                End If
    End With

    So you basically mean that it is not possible to display the dialog with the advanced options from vba, don´t you?

    Thank you very much again. BR, FoNs.

    • Edited by My Sharona Thursday, February 09, 2012 8:42 AM
    Thursday, February 09, 2012 8:41 AM
  • You're correct - as far as I know it is not possible to display the Save As dialog with all options from VBA in PowerPoint.

    Regards, Hans Vogelaar

    • Marked as answer by My Sharona Tuesday, February 14, 2012 11:19 AM
    Thursday, February 09, 2012 12:21 PM
  • My Sharona

    The feature that you are looking for is called ".ExportAsFixedFormat Method"

    Though you cannot display that in the File Dialog but you can create your own file dialog with those option buttons and then in the save as routine pass the relevant values for example the syntax is

    expression.ExportAsFixedFormat(Path, FixedFormatType, Intent, FrameSlides, HandoutOrder, OutputType, PrintHiddenSlides, PrintRange, RangeType, SlideShowName, IncludeDocProperties, KeepIRMSettings)

    The FixedFormatType takes the values for those option buttons.

    For Standard(publishing online and printing), the value of FixedFormatType is ppFixedFormatIntentPrint and

    For Minimize size(publishing online), the value of FixedFormatType is ppFixedFormatIntentScreen which is the default.

    For more info on .ExportAsFixedFormat, please see the below link.

    Topic: Presentation.ExportAsFixedFormat Method

    Link: http://msdn.microsoft.com/en-us/library/bb231096%28v=office.12%29.aspx




    Sid (A good exercise for the Heart is to bend down and help another up) Please do not email me your questions. I do not answer questions by email unless I get paid for it :) If you want, create a thread in VB.Net/Excel forum and email me the link and I will help you if I can.

    • Marked as answer by My Sharona Tuesday, February 14, 2012 11:19 AM
    Thursday, February 09, 2012 2:29 PM
    Moderator
  • Hi Hans, Hi Siddharth

    Thank you for your answers.

    @Siddharth: I proceeded in the way you recommended me, so I created a user form with my custom controls. Your solution works, but I would say that ppFixedFormatIntentPrint and ppFixedFormatIntentScreen correspond to the field Intent and not FixedFormatType; appart from this detail, the rest is what I was looking for.

    Thank you very very much.


    BR, Fons.

    Tuesday, February 14, 2012 11:18 AM