How to use FormFields with Office 2003 ??

F

Frank

Hi,

I've use FormFields.Item method with Word 2000 to insert a text in a
document:

Word.ApplicationClass cWord = new Word.ApplicationClass();
object n == System.Reflection.Missing.Value;
object oText0 = Apllication.StartupPath + \\Test.doc;
object oText1 = "Text1";
object oText2 = "Text2";
cWord.Visible = true;
cWord.Documents.Open(ref oTest1, ref n , ...);
cWord.ActiveDocument.FormFields.Item(ref oTest2).Result=TextBox1.Text;

The problem now is that i've installed Word 2003 and it won't work
anymore. Do you have any idea how can i adapt the situation with Word
2003??

Sincerely,

Francois
 
C

Cindy M -WordMVP-

Hi Frank,

As far as word's object model goes, there is no difference handling form
fields. Looking at your code, though, you've declared object oText2 =
"Text2" but use oTest2 for the Item; ditto for oText1. No idea if this
is a type (s instead of x), or if your code really looks like this. If
it does, I'm surprised in worked in 2000...
I've use FormFields.Item method with Word 2000 to insert a text in a
document:

Word.ApplicationClass cWord = new Word.ApplicationClass();
object n == System.Reflection.Missing.Value;
object oText0 = Apllication.StartupPath + \\Test.doc;
object oText1 = "Text1";
object oText2 = "Text2";
cWord.Visible = true;
cWord.Documents.Open(ref oTest1, ref n , ...);
cWord.ActiveDocument.FormFields.Item(ref oTest2).Result=TextBox1.Text;

The problem now is that i've installed Word 2003 and it won't work
anymore. Do you have any idea how can i adapt the situation with Word
2003??

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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