none
How to set default type in Excel.Dialog object? RRS feed

  • Question

  • Office.FileDialog has FilterIndex property to set default type in the dialog. I have 

    Excel.Dialog dialog = _excelApp.Dialogs[Excel.XlBuiltInDialog.xlDialogSaveAs];

    and want to do something similar for Excel.Dialog, i.e. to set default save format. I see that there is no that kind of property for Excel.Dialog, is there another way I can set default save format? 

    Thursday, October 12, 2017 3:00 PM

Answers

  • Hi Davit93,

    You could set the default save format via setting args of the Dialog.Show Function. Args list for the Show  function is different according to the dialog type.

    According to Built-In Dialog Box Argument Lists, we could know we could custom document_text, type_num, prot_pwd, backup, write_res_pwd, read_only_rec for built-in save as dialog.

    So we need to change type_num to the type we want, we could know type_num list from here.

    https://msdn.microsoft.com/en-us/vba/excel-vba/articles/xlfileformat-enumeration-excel

    For example, we want to save as the file as xlsm file, we could use

    dialog.Show(Arg2:52);

    Best Regards,

    Terry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Davit93 Friday, October 13, 2017 7:28 AM
    Friday, October 13, 2017 2:45 AM