简体   繁体   中英

Excel VSTO sort dialog box C#

I'm trying to rewrite some VBA code in Excel VSTO.

The VBA code is as follows:

Application.Dialogs(xlDialogSort).Show

When I try to do the same in VSTO I find that the same method needs 30 arguments! The signature is "Show(object Arg0,object Arg1, etc.)"

Globals.RiskViewerWorkbook.ThisApplication.Dialogs[XlBuiltInDialog.xlDialogSort].Show(null,null,null,... );

What values do I need to pass to make the same call as the VBA code is using? null does not work.

I started writing this question and then discovered the answer so I'll post it and an answer.

The solution was to pass the value "missing" as each of the arguments.

http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.displaydrawingobjects(VS.80).aspx

this.Application.Dialogs[Excel.XlBuiltInDialog.xlDialogSort].Show(
    missing, missing, missing, missing, missing, missing, missing, missing,
    missing, missing, missing, missing, missing, missing, missing, missing,
    missing, missing, missing, missing, missing, missing, missing, missing,
    missing, missing, missing, missing, missing, missing);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM