Jump from FormField to FormField

T

Thomas M

Hi.
I'm making a script that I want to jump from one formfield to the
next. Below is the code. How do I get this vbs code to jump to the
next FormField?


Set objWord = createobject("word.application")
objWord.visible = True

Set objDoc = objWord.Documents.Add("c:\mydoc.doc", false)
objDoc.FormFields("Text4").Result = "Some text"
objDoc.FormFields("Text4").Next.select
'The next line fails
objDoc.Selection.Result = "Text in the next FormField"
 
D

Doug Robbins - Word MVP

I would strongly suggest that you avoid using the selection at all costs. I
would also suggest that you give meaningful names to the bookmarks assigned
to the formfields,especially if you want to access them via vba.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Thomas M

I would strongly suggest that you avoid using the selection at all costs. I
would also suggest that you give meaningful names to the bookmarks assigned
to the formfields,especially if you want to access them via vba.

I too prefer specific names for each formfield. However, the company
document that is to be used, does not have all formfields named.
Therefore, I cannot address each formfield. And I'm not allowed to
change the document. This is why I want to jump from field to field.

Regards,
Thomas
 

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