D
doru.bargaoanu
Hi,
I have this configuration :WindowsXP SP2, Microsoft .NET Framework
1.1,VS.Net, MS Office Word 2003,Office 2003 Primary Interop Assemblies
(O2003PIA) and I get this error when I try to insert a text on a
bookmark.
'Microsoft.Office.Interop.Word.Bookmarks' does not contain a definition
for 'Item'
Here is the function I'm using :
private void BookMarkReplaceRange(ref Word.Document ThisDocument,
string
bookmarkName, string newText)
{
try
{
object missingValue = Type.Missing;
object oBookmarkName = bookmarkName;
Word.Range rng = ThisDocument.Bookmarks.Item(
ref oBookmarkName).Range;
rng.Text = newText;
object oRng = rng;
ThisDocument.Bookmarks.Add(bookmarkName, ref oRng);
}
catch (Exception ex)
{
CGlobals.Logger.WriteLine(LogType.Error, ex);
}
}
Does anyone have an idea what might be the problem ?
I tried the same code on another machine with MS Office Word XP (2002)
with OffXp PIAs but no luck. What am I doing wrong ?
Thanks,
Doru
I have this configuration :WindowsXP SP2, Microsoft .NET Framework
1.1,VS.Net, MS Office Word 2003,Office 2003 Primary Interop Assemblies
(O2003PIA) and I get this error when I try to insert a text on a
bookmark.
'Microsoft.Office.Interop.Word.Bookmarks' does not contain a definition
for 'Item'
Here is the function I'm using :
private void BookMarkReplaceRange(ref Word.Document ThisDocument,
string
bookmarkName, string newText)
{
try
{
object missingValue = Type.Missing;
object oBookmarkName = bookmarkName;
Word.Range rng = ThisDocument.Bookmarks.Item(
ref oBookmarkName).Range;
rng.Text = newText;
object oRng = rng;
ThisDocument.Bookmarks.Add(bookmarkName, ref oRng);
}
catch (Exception ex)
{
CGlobals.Logger.WriteLine(LogType.Error, ex);
}
}
Does anyone have an idea what might be the problem ?
I tried the same code on another machine with MS Office Word XP (2002)
with OffXp PIAs but no luck. What am I doing wrong ?
Thanks,
Doru