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 / November 2005

Tip: Looking for answers? Try searching our database.

Jump from FormField to FormField

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Thomas M - 14 Nov 2005 16:05 GMT
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"
Doug Robbins - Word MVP - 14 Nov 2005 21:06 GMT
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.

Signature

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

> Hi.
> I'm making a script that I want to jump from one formfield to the
[quoted text clipped - 9 lines]
> 'The next line fails
> objDoc.Selection.Result = "Text in the next FormField"
Thomas M - 15 Nov 2005 07:37 GMT
>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
 
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.