Navigate out of embedded object to a specific formfield

K

Karen Clark

I am developing a Word 2000 form that contains three
embedded Objects (Word Docs) displayed as icons. The user
will double-click one or more of the icons to launch the
embedded Word docs. When the user has completed filling
out the form fields in the embedded document, he will save
and close, and will be returned to the main document, to
continue completing the form fields there.

The document is divided into sections. The area where the
object icons are located is unprotected, so the user can
double-click to launch the objects. The rest of the
document is protected for form fields.

Everything works great! Except for one minor detail...

After the user saves and closes the embedded doc, he is
returned to the main doc -- but the object icon is still
selected. Should the user press <Tab> at this point, the
object icon is deleted.

It would be idea if, when the user closes the embedded
doc, his cursor would be located in the next formfield.

I am VERY new at writing VB code. Can anyone help me write
a procedure that would run on exit in each of these three
embedded docs that would direct the user's cursor to a
specific formfield in the main document?

Thank you thank you thank you...
Karen Clark
 
J

Jean-Guy Marcil

Karen Clark was telling us:
Karen Clark nous racontait que :
I am developing a Word 2000 form that contains three
embedded Objects (Word Docs) displayed as icons. The user
will double-click one or more of the icons to launch the
embedded Word docs. When the user has completed filling
out the form fields in the embedded document, he will save
and close, and will be returned to the main document, to
continue completing the form fields there.

The document is divided into sections. The area where the
object icons are located is unprotected, so the user can
double-click to launch the objects. The rest of the
document is protected for form fields.

Everything works great! Except for one minor detail...

After the user saves and closes the embedded doc, he is
returned to the main doc -- but the object icon is still
selected. Should the user press <Tab> at this point, the
object icon is deleted.

It would be idea if, when the user closes the embedded
doc, his cursor would be located in the next formfield.

I am VERY new at writing VB code. Can anyone help me write
a procedure that would run on exit in each of these three
embedded docs that would direct the user's cursor to a
specific formfield in the main document?


ActiveDocument.Bookmarks("Text1").Range.Fields(1).Result.Select


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

Karen Clark

ActiveDocument.Bookmarks("Text1").Range.Fields
(1).Result.Select


If I am understanding correctly, that procedure would move
my cursor to a specific field in the SAME document.

I need to move my cursor to a specific field in the MAIN
document after saving and closing the EMBEDDED document.
 
J

Jean-Guy Marcil

Karen Clark was telling us:
Karen Clark nous racontait que :
ActiveDocument.Bookmarks("Text1").Range.Fields
(1).Result.Select


If I am understanding correctly, that procedure would move
my cursor to a specific field in the SAME document.

I need to move my cursor to a specific field in the MAIN
document after saving and closing the EMBEDDED document.

Exactly, I understood from you post that you needed to get to a specific
field after closing the embedded document. So, how can any code take you to
a field in an embedded document after it is closed? Once the embedded
document is closed ActiveDocument refers to the MAIN document, unless you
have a bunch of opened documents.

To have more control, do this:

At the top of the code:

Dim CurrentDoc As Document
Set CurrentDoc = ActiveDocument

Since the code hasn't had time to mess around with anything yet, it is 100%
certain that CurrentDoc will point to the doc where the call was initiated
(the MAIN document).

Then, mess around all you want with the embedded document or documents.

Then:

CurrentDoc.Bookmarks("Text1").Range.Fields(1).Result.Select

Will point to a bookmark in the MAIN document.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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