Group: microsoft.public.word.vba.general
From: "Graham Mayor"
Date: Thursday, March 06, 2008 4:58 AM
Subject: Re: Export form data to other form in Word

Add
Target.Activate
immediately before End If

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

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


QAadmin wrote:
> Thank you very much Graham. I've made my adjustments, and the code
> worked great. The only question I have is how to make that second
> form stay on top of the first form? when I check Yes, the other forms
> opens up with the info that I need in it, but it's behind the
> original invoking form. It's probably a one or two lines of code, but
> I am not sure what...
> Thank you again.
>
> "Graham Mayor" wrote:
>
>> 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.


Safety Articles | Usenet Groups | Usenet News | Bluegrass