none
System.Reflection.Missing.Value cannot be used like a method RRS feed

  • Question

  • I am trying to create a word document using VS2010 and get the above error to this command

    object oMissing = System.Reflection.Missing.Value();

    I am new to office automation, but I copied this verbatim from an example posted on the web, any help would be greatly appreciated.

    Friday, September 21, 2012 3:27 PM

Answers

  • Don't use the parentheses in the assignment:

    object oMissing = System.Reflection.Missing.Value;

    Parentheses at the end tell the C# compiler something is a method. The fingers of whomever typed that example you found in the Internet were working on AutoPilot :-) Or it was a code example from a non-.NET language similar to C#.


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, September 22, 2012 6:02 AM
    Moderator