InvokeMember "InchesToPoints" doesn't work MS Word

D

Dmitry Nogin

Hi,

The following code works well for MS Excell but fails on MS Word...
Can you suggest anything? (.NET 2.0)


Type wordType = Type.GetTypeFromProgID("Word.Application");
object wordApplication = Activator.CreateInstance(wordType);

object margins = wordType.InvokeMember("InchesToPoints", BindingFlags.InvokeMethod,
null, wordApplication, new object[] { (double)1 });

The last line fails with E_FAIL on WinWord2003, WinWord2007

What is interesing? You can replace ProgID to Excel.Application - it works. You can replace InchesToPoints to PixelsToPoints - it does work. What's wrong about it?!

Thanks.

-- dmitry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top