Can someone tell me what the parameters are?

  • Thread starter Thread starter Henry Stock
  • Start date Start date
H

Henry Stock

I was just looking that the Word Document Model and at code for creating a
Word Document. The C# code appears to have several more parameters for
creating a Word Document than does Visual Basic. I am curious why...
As you can see from the code below they list 3 ref variables after the
template. What can you do with those variables?

Visual Basic
ThisApplication.Documents.Add(Template:="C:\Test\MyTemplate.Dot")

// C#
object missingValue = Type.Missing;
object template = "c:\\temp\\MyTemplate.dot";
ThisApplication.Documents.Add(ref template, ref missingValue, ref
missingValue, ref missingValue);
 
Henry,

The reason for this is because C# doesn't support optional parameters,
which COM does. Because of this, you are forced to pass in values for every
parameter, the missing ones being Type.Missing.

Hope this helps.
 
Back
Top