Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Cannot use Items function in several Word classes from C# in Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phil - 06 Sep 2006 17:56 GMT
I have a C# .NET program that links to Word via a reference to MSWORD.OLB.
After I upgraded to Office 2003, I get compiler errors on
Word.Tables.Item(), Word.Columns.Item(), and Word.Templates.Item().

When I try the same code in Word VBA, it works.

Any ideas why this is suddenly unacceptable.

Phil
Cindy M. - 07 Sep 2006 09:57 GMT
Hi =?Utf-8?B?UGhpbA==?=,

> I have a C# .NET program that links to Word via a reference to MSWORD.OLB.
> After I upgraded to Office 2003, I get compiler errors on
[quoted text clipped - 3 lines]
>  
> Any ideas why this is suddenly unacceptable.

Which version of Word did you upgrade FROM? My guess would be 2000, and that
your original project compiled against IAs that VisualStudio generated
automatically...

Note that Microsoft does NOT support using a single solution for multiple
versions of an Office program. MS recommends you create a solution for each
version you intend to support, tested and compiled against the (P)IAs for
that version. The automatically generated IAs for 2000 can differ
significantly from the *optimized* PIAs of another (later) version.

What you can try beyond separate solutions:
- Dave Thielen's "tweaked" the Word 2000 IAs to make them more "compatible"
http://www.thielen.com/users/dave/programming.htm

- Use Reflection (late-binding) to pick up the individual objects in a
collection where you're getting conflicts

Note that the office.developer.automation newsgroup would be the better venue
to pursue this kind of question than a VBA-specific group :-)
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.office.
developer.automation&lang=en&cr=US

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.