I am using C # 4.0 to instantiate Excel.Application and open Excel.Workbook . My code is as follows:
Excel.Application xlApp; Excel.Workbook xlWorkBook; xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Open("someFile");
The Open() method has a load of additional values ββthat I do not need to provide. This is convenient, except that I do not know what the default values ββare for these optional parameters. Thus, I cannot decide if I need to provide a value.
In this case, I can find the information I need for some parameters in the MSDN documentation. Is there a general way to define default values ββfor optional parameters in the COM interaction type?
UPDATE:
Using oleview on MSO.dll , I checked the appropriate IDL for the Workbook interface. For the SaveAs() method, it looks like this:
HRESULT SaveAs( [in, optional] VARIANT Filename, [in, optional] VARIANT FileFormat, [in, optional] VARIANT Password, blahblah... [in, optional, defaultvalue(1)] XlSaveAsAccessMode AccessMode, blahblah... [in, optional] VARIANT Local, [in, lcid] long lcid);
In Visual Studio, intellisense shows [object Filename = Type.Missing] for most parameters, which I think makes sense because the IDL does not provide any type information ( VARIANT ), nor about any default value. However, for the AccessMode parameter AccessMode IDL provides the necessary information, and intellisense displays it.
So now I ask the question: why is the IDL not more specific in terms of type (and default value) for all parameters, as for AccessMode ?