Geeks With Blogs

News QTP and Stuff
Theo Moore Questions... Morphology? Longevity? Incept dates?

OK, I am NOT trying to bait an argument here...I like both VB.Net and C#. I really do.  I am totally comfortable in either of them. However, I am working on a project the needs me to work in C# and use Word Interop.

I am stunned to find this is actually much harder in C# than VB.net. Ironically, C# is usually a much less verbose (more concise?) language, but not in this case. If I want to open a word doc in VB.Net, it's a simple as:

vbVersion

 

Pretty easy.

 

C#? Not so easy....

cversion

 

That's a lot of code to open a doc! Also, the compiler does something strange. The underlined line in this last screenie goes away...once you build the project. However, if you do *anything* in the file (even adding a space) and the underlining comes back. The error it gives you is "Cannot create an instance of the abstract class or interface 'Microsoft.Office.Interop.Word.Application'

Just a little gotcha I spent a couple of hours "figuring out"... :-)

Posted on Monday, July 28, 2008 10:56 PM | Back to top


Comments on this post: Word Interop: Cannot create an instance of the abstract....

Comments are closed.
Comments have been closed on this topic.
Copyright © Theo Moore | Powered by: GeeksWithBlogs.net