none
Save As dialogue in Excel and PowerPoint 2010 RRS feed

  • Question

  • I have the following code in a Word Add-in. How do I do the same in Excel and PowerPoint?

    # The call that I want to replicate dynamic dialogue = this.OfficeExtensionObject.SaveAsDialog;

    # Call the Word SaveAs dialogue but don't perform the save yet. int rez = dialogue.Display(); using Microsoft.Office.Interop.Word; # snippet from my Word class public dynamic SaveAsDialog { get { return this.WordApplication.Dialogs[Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFileSaveAs];} }



    • Edited by ChrisCJ Wednesday, July 30, 2014 3:40 PM Clarification
    Wednesday, July 30, 2014 3:30 PM

Answers

  • Hi Chris

    Back when these dialog boxes and APIs were introduced to the Office products the products were individual applications and there was no attempt to co-ordinate capabilities. The Word dialog box interface was introduced in Word 2.0, back in the early nineties, for example.

    There is simply no corresponding interface in Excel or PowerPoint. You have to "roll your own" if you need this kind of capability. Or perhaps work through the Windows API.


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, August 3, 2014 8:10 AM
    Moderator

All replies

  • Hi Chris,

    We can use Dialogs Object in Excel to display the dialog, here is a sample for your reference:

    Globals.ThisAddIn.Application.Dialogs[XlBuiltInDialog.xlDialogSaveAs].Show();


    And there is no such API in PowerPoint Object Model(refer to in Dialog Boxes by Using PowerPoint Object Model), as a workaround we can use SendKey to simulate pressing F12 to active the build-in dialog. Here is the code for your reference:

    SendKeys.Send("{F12}"); 

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 31, 2014 5:41 AM
    Moderator
  • Yes, we understand that but we need to display the dialogue, then capture the result, then do our own checks and processing afterwards, i.e., don't execute the save. This functionality exists in Word:

    var dialogue = this.WordApplication.Dialogs[Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFileSaveAs];

    # Call the Word SaveAs dialogue but don't perform the save yet. int rez = dialogue.Display();

    ... process our checks... If OK...

    dialogue.Execute();



    Thursday, July 31, 2014 9:17 AM
  • Hi Chris

    Back when these dialog boxes and APIs were introduced to the Office products the products were individual applications and there was no attempt to co-ordinate capabilities. The Word dialog box interface was introduced in Word 2.0, back in the early nineties, for example.

    There is simply no corresponding interface in Excel or PowerPoint. You have to "roll your own" if you need this kind of capability. Or perhaps work through the Windows API.


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, August 3, 2014 8:10 AM
    Moderator
  • Hi Cindy,

    That what I thought. In the end, I have gone for invoking the Office dialogues. That way, I lose the customised dialogues, but gain consistency between all three applications.

    Tuesday, August 5, 2014 9:31 AM