Word.Bookmarks .NET & yeesh

O

Onchu

Can anyone explain why bookmarks "Item" is not available in Office
2003? (see this example: http://support.microsoft.com/kb/316383/en-us).
I developed a .Net app on one development machine w/Office2K, the same
app fails on my second development machine (Office2003) with
"'Word.Bookmarks' does not contain a definition for 'Item'".

I've searched and read a few responses that indicate I should use
_getItem, but this method is not available on the 2003 PC either. I
have installed the latest PIAs.

If this in an incompatibility with the Interop modules, and if so, is
there a workaround or do I have to rewrite this code completely. If I
rewrite it will it be compatible across MSOffice versions?

Thanks alot for any and all advice.
Peter
 
C

Cindy M.

Hi Peter,
Can anyone explain why bookmarks "Item" is not available in Office
2003? (see this example: http://support.microsoft.com/kb/316383/en-us).
I developed a .Net app on one development machine w/Office2K, the same
app fails on my second development machine (Office2003) with
"'Word.Bookmarks' does not contain a definition for 'Item'".

I've searched and read a few responses that indicate I should use
_getItem, but this method is not available on the 2003 PC either. I
have installed the latest PIAs.

If this in an incompatibility with the Interop modules, and if so, is
there a workaround or do I have to rewrite this code completely. If I
rewrite it will it be compatible across MSOffice versions?
I can confirm that Word 2003 works with

object objBkmName = "theBookmark"
Word.Bookmark bkm = doc.Bookmarks.get_item(ref objBkmName);

Could be that it's not showing up in Intellisense, but it should compile.
However...

When you create a .NET project reference to an Office 2000 application,
TlbImp generates a set of IAs. PIAs, as provided for Office XP and 2003,
have usually been "tweaked" for performance and interoperability between
NET and COM. So the auto-generated IAs and PIAs may well differ.

Microsoft doesn't support writing a single solution for multiple versions
of an Office application. Indeed, it recommends a solution for each
version.

What you could *try* - but no guarantees - is to make certain your
solution is linked to your IAs. And distribute the IAs with the solution.
In this case, the code won't even check in the GAC for the PIAs. The only
problem could be if MS changed something in the automation interface. As
far as I know, this wasn't the case for bookmarks; it did happen for a
couple of things to do with mail merge, though.

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 :)
 
O

Onchu

Cindy -
Thanks alot for the tips... much appreciated. I'll post again later
when it's resolved.
Peter
 

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