<CharlieDigital/> Programming, Politics, and uhh…pineapples

9Feb/09Off

When False Means True

I encountered an interesting problem while working with our FirstPoint Office add-in (one of the many joys of working with the Office API!).


In this case, a call to ActiveDocument.CanCheckIn() would return true, even when the value was clearly false. Testing in the VB macro editor in Word would return the correct value consistent and so would invoking the method from the Visual Studio command window.


In Word 2007, this API call seems to work just fine. However, in Word 2003, I had to use reflection to invoke the method to get a proper result:


Type type = _host.ActiveDocument.GetType();
MethodInfo m = type.GetMethod("CanCheckin");
object result = m.Invoke(_host.ActiveDocument, null);
canCheckInDocument = Convert.ToBoolean(result);

Posted by Charles Chen

Filed under: Office Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.