Built-In Dialogs via Microsoft Excel Interop 11.0 Object Library

Hi.

Im currently working on an Excel Add-in and I am wondering if its possible to bring up a built in dialog box to allow users to select cells, and then the selected cell references to be returned to my code. I have access to the Excel Interop 11.0 Object Library.

I have found the following code to display various built-in Excel dialog boxes, however the documentation is poor and I cant find the correct built in dialog, and if I did, have no idea how to access its return values to find what the user selected. Due to the porting to C# .NET code, the following function is a bit messy and I have no idea what parameters each type of built in dialog takes.

Microsoft.Office.Interop.Excel._ApplicationExcelApp = // Some code to access the underlying Excel API.

ExcelApp.Dialogs[XlBuiltInDialog.<DialogTypeHere> ].Show( // Lots of parameters );

where <DialogTypeHere> is one of the choices from theXlBuiltInDialogenum.
You can see the choices here:http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.excel.xlbuiltindialog(VS.80).aspx

the Show method has the following signiture:

bool Dialog.Show( object Arg1, object Arg2, object Arg3, ... object Arg29, object Arg 30 );

I am looking for a specific dialog that is often used all around Excel. The best way to descibe it would be the 'Insert Range Reference' dialog. It minimises the current form and allows the user to select a cell, then returning to the original form with the selected cells reference pasted into the corrosponding text box.

For an example, within Excel 2003 (and probably most other versions) go to Insert -> Name -> Define. Within that form, click the little box in the bottom right, next to the "Refers To:" text box. That then minimised the 'Define Name' form, allows the user to select a range, and then restores the form, with the selected range's reference inserted back into the "Refers To:" text box. Im looking for similar functionality for my own Form within Excel.

As there is a huge list of accessible built-in dialogs, I imagined this one would be easy to find. However, Im dubious to if its even possible, as I cant see how I would gain access to the selected range the user selected - the Show method simply returns a bool value. I could probably make my own, but it would not tie in as nicely with the original.

Any ideas, comments, or similar previous experience is greatly appreciated.

Cheers.

Tyson.

[3115 byte] By [Tyson] at [2007-12-28]