Auto fill and macros in a protected form

G

Guest

I have read through all similar postings, but none quite fit.

I'm trying to set up an order form with a "bill-to" and "ship-to" that may
or may not be the same. I have a few questions:

1) How do I use a check box labeled "Same" and have all the bill-to fields
(name, address, city, state, etc) auto fill in the ship-to fields. Sometimes
the bill-to and ship-to are not the same so I need to be able to track both
sets of data.

2) How do I track all data (whether the fields are changed or not)? Does the
solution to question 1 "overwrite" the fields if the data is the same?

3) I have set up my own macro, but in order for the form to work, it need to
be protected, and then if the form is protected, my macro errors, telling me
to unprotect the document. How do I get that to function properly?

Thanks in advance
 
G

Greg Maxey

Say the billing name field was named "BName" and the shipping name field is
named "SName." You could run an on exit macro from the checkbox named
"Same."

Change "SomeOtherField to the field name that you want to skip to if the
same box is checked.

Sub OnExitSame()
Dim oFlds As FormFields
Set oFlds = ActiveDocument.FormFields
If oFlds("Same").CheckBox.Value = True Then
oFlds("SName").Result = oFlds("BName").Result
'Add other similiar field pairs here
oFlds("SomeOtherField").Select
Selection.Range.Fields(1).Result.Select
End If
End Sub
 
G

Guest

To anyone that is interested, Greg did help me with a solution. He is
Phenomenal!
Thanks Greg,

CAC
 

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