Group: microsoft.public.word.vba.general
From: "Graham Mayor"
Date: Wednesday, March 05, 2008 6:44 AM
Subject: Re: Export form data to other form in Word

Assuming a protected form with form fields the following macro will open the
other document - here called D:\My Documents\Test\Versions\Odd\Doc2.doc when
the check box Check1 is checked and writes the content of the text field
Text1 in the source document into the form field Text2 in the opened
document. Change (and add) the field and document names to suit your
requirements

Sub CopyDataToAnotherDoc()
Dim Source As Document
Dim Target As Document
Dim sField1 As String

Set Source = ActiveDocument
If Source.FormFields("Check1").CheckBox.Value = True Then
Documents.Open FileName:="D:\My Documents\Test\Versions\Odd\Doc2.doc"
Set Target = ActiveDocument
sField1 = Source.FormFields("Text1").Result
Target.FormFields("Text1").Result = sField1
End If
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


QAadmin wrote:
> Hi everybody,
> Is there a way I can import data from one Word form into another Word
> form? I have a form where there is a Yes/No checkbox, and when the
> user checks Yes, another form opens up. I have a code that actually
> does open another form, but my problem is how to actually "link" the
> two, that is, the second form should have some identification as to
> which form actually invoked it.
> Thanks in advance.