To add a default parameter (called an optional parameter in VBA) in the COM library, you need to set the parameter flag in the type library editor. Click on the modifier column, then the button for the corresponding parameter. Check the box next to "Use default value" and place the default value in the provided edit box.
Now for the problem. In Delphi 2009, there is an error in the type library editor that tries to write the date to the ridl file as a string. The editor should actually convert this to an integer. This does not compile. Fortunately, the ridl file is a string file and can be edited. So this is what you will see in the ridl file
HRESULT _stdcall DevelopmentCount([in, defaultvalue(29/12/1899)] DATE);
change this date to an integer (note 30/12/1899 is 0)
HRESULT _stdcall DevelopmentCount([in, defaultvalue(-1)] DATE);
Now the dll will compile and the default value will be applied.
Please note: if you open the type library in Delphi, it will replace the integer with the date string, and you will not be able to compile it, so you will have to continue changing it. I do not know if this was fixed in Delphi 2010.
Steve source share