Macro to copy data in form field

C

ChrisK

I've been trying to have a macro run when a check box is checked. The macro
would copy data from previous fields on the form and insert it in another
field on the form. i.e. custname to projname, custadd to projadd etc. Can
anyone offer a suggestion?

Thanks
 
G

Graham Mayor

You can run a macro on exit from a form field including a check box field eg

Sub IsChecked()
If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
ActiveDocument.FormFields("projname").Result = _
ActiveDocument.FormFields("custname").Result
ActiveDocument.FormFields("projadd").Result = _
ActiveDocument.FormFields("custadd").Result
Else
ActiveDocument.FormFields("projname").Result = ""
ActiveDocument.FormFields("projadd").Result = ""
End If

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

ChrisK

Thanks works like a charm!!
Graham Mayor said:
You can run a macro on exit from a form field including a check box field eg

Sub IsChecked()
If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
ActiveDocument.FormFields("projname").Result = _
ActiveDocument.FormFields("custname").Result
ActiveDocument.FormFields("projadd").Result = _
ActiveDocument.FormFields("custadd").Result
Else
ActiveDocument.FormFields("projname").Result = ""
ActiveDocument.FormFields("projadd").Result = ""
End If

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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