none
API to launch Word Save As menu through VBA RRS feed

  • Question

  • Is there any VBA call that opens up the Save As menu (in backstage view) in Word, Excel and Powerpoint 2010?

    Note: I need a command that works similar to Application.FileSave in MS Project for an unsaved newly created document.


    Parul Gupta

    Tuesday, October 23, 2012 10:30 AM

Answers

  • Hi Parul

    As far as I know, the only way to do what you ask would be to emulate the user pressing keys to reach that "page".

    If you press ALT that will show you the current keyboard assignments to access commands in the Ribbon and other elements of the Fluent UI. On my installation, that would be Alt, F, A

    A key sequence can be sent to the Office application using the SendKeys command.

    Theoretically, this should work fine but you need to be aware that the key sequence is not guaranteed. If some add-in assigns the same letter to a command of its own there would be a conflict. Office resolves the conflicts by changing the keyboard assignments "on the fly".

    The other possibility would be to try whether this can be done using the Ribbon Accessibility APIs, but those won't be simple to access via VBA:  http://msdn.microsoft.com/en-us/library/bb404170.aspx


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Ninja8 Friday, November 2, 2012 6:02 AM
    Thursday, November 1, 2012 11:29 AM
    Moderator

All replies

  • In Word:

    Application.Dialogs(wdDialogFileSaveAs).Show

    In Excel:

    Application.Dialogs(xlDialogSaveAs).Show

    PowerPoint does not have a direct equivalent, but in all three applications, you can use code like this:

    Sub ShowSaveAs()
        Dim strFileName As String
        With Application.FileDialog(2) ' msoFileDialogSaveAs
            If .Show Then
                strFileName = .SelectedItems(1)
                ' For Word, use 
                ActiveDocument.SaveAs FileName:=strFileName
                ' For Excel, use
                ActiveWorkbook.SaveAs FileName:=strFileName
                ' For PowerPoint, use
                ActivePresentation.SaveAs FileName:=strFileName
            Else
                ' Dialog cancelled
            End If
        End With
    End Sub


    Regards, Hans Vogelaar

    Wednesday, October 24, 2012 7:51 AM
  • Hi Hans,

    I am looking for a similar call that takes you to backstage view Save As tab in Office 2013 and doesn't directly pops up the Save dialog as is the case with MS Project 2013 VBA API Application.FileSave().

    Thanks,

    Parul


    Parul Gupta


    • Edited by Ninja8 Tuesday, October 30, 2012 8:45 AM
    Tuesday, October 30, 2012 8:44 AM
  • I don't have Office 2013 yet, so I can't help you with that, sorry.

    Regards, Hans Vogelaar

    Tuesday, October 30, 2012 5:17 PM
  • Hi Parul

    As far as I know, the only way to do what you ask would be to emulate the user pressing keys to reach that "page".

    If you press ALT that will show you the current keyboard assignments to access commands in the Ribbon and other elements of the Fluent UI. On my installation, that would be Alt, F, A

    A key sequence can be sent to the Office application using the SendKeys command.

    Theoretically, this should work fine but you need to be aware that the key sequence is not guaranteed. If some add-in assigns the same letter to a command of its own there would be a conflict. Office resolves the conflicts by changing the keyboard assignments "on the fly".

    The other possibility would be to try whether this can be done using the Ribbon Accessibility APIs, but those won't be simple to access via VBA:  http://msdn.microsoft.com/en-us/library/bb404170.aspx


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Ninja8 Friday, November 2, 2012 6:02 AM
    Thursday, November 1, 2012 11:29 AM
    Moderator
  •  Cindy.., Thanks for the information...!!

    Parul Gupta

    Friday, November 2, 2012 6:02 AM