论坛: 开发者论坛 (Thread #38965)

Accessing Application.WordBasic property produces invalid cast result (2017-10-25 13:05 by chadknudson #80376)

I wrote a little addin using Microsoft's Interop and was trying to reproduce the issue that I was having with accessing the WordBasic property off of the Application object. Any time I access the WordBasic property I receive an invalid cast error.

I thought perhaps my issue was that I was incorrectly trying to use the InvokeMember method to call functions in WordBasic. With the Microsoft Interop I was able to create a small WordBasicHelper that enabled me to make calls to DisableAutoMacros and this worked fine with Microsoft's office interop but NetOffice produced the dreaded Invalid Cast when trying to make the assignment:

object wordbasic = (object)Word.Application.WordBasic;

I can send you my test app solution that I created with Microsoft's interop to demonstrate the correct behavior.

Re: Accessing Application.WordBasic property produces invalid cast result (2017-10-25 23:00 by sebastiandotnet #80379)

[Reply To Message #80376]

Please send to: knautschkuh[at]hotmail.com
I want have a look into and try to find a solution how i can use the proof-of-concept in NetOffice.

thank you for help!

*Sebastian
回复到 #80376