Log in

View Full Version : Sleeper: Help with AutoText



elaineada75
05-13-2019, 05:22 AM
I want to make use of Autotext to help populate table with the help of legacy forms. Pl see attached file

https://drive.google.com/open?id=182Ed-HYIveWOPgJo4iCOhy1xR5A5CCjW

While it can work, but i cannot change the text content of the table. The content for whatever reason, always revert to the original text whenever i want to print. I have been trying for days to look at the settings, but it still cannot work. Pl help!

gmaxey
05-13-2019, 06:21 AM
Elaine,

The file you linked has no VBA code or AutoText stored so it is hard to say what it is you are trying to do. Have to ask, why you are using content controls for the the text fields and legacy from fields for the dropdowns?

elaineada75
05-13-2019, 06:05 PM
Hi Greg
I have the dropdown and the if statement to control the correct table to appear on the next page.
This is the correct file. I know very little on vba in word and hence i used the if statement to control. The table will guide the user on the correct content to complete. But while the user is able to complete the table after unprotecting the file, the user is not able to print. The print copy will always revert to the blank table. 24210

gmaxey
05-14-2019, 07:39 AM
See the attached

elaineada75
05-14-2019, 04:52 PM
Hi Greg
Thanks, the problem comes in when i want to print. If i make any amendments to the table, on the screen it is ok, but when i go ahead to print, it just automatically switch back to the original template and all my changes is gone. I dont understand why. Pl help. Thanks.

gmaxey
05-14-2019, 05:07 PM
That is probably because you have fields updating on print. So when it updates the field it puts the autotext back in.

In the ThisDocument Module of the template I sent earlier, replace the existing code with:


Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
ActiveDocument.Fields.Update
ActiveDocument.Fields.Unlink
End Sub

elaineada75
05-14-2019, 05:17 PM
Hi Greg
there is a run-time error when i replace the code
'the unlink method or property is not available because the object refers to a protected area of the document'
and when i try to unprotect it, the table cannot be automatically update when i change the field. Pl help. Thanks.

gmaxey
05-14-2019, 05:52 PM
You can try the attached, but note after a selection is made the fields are unlinked. Your user can't go back and change their minds.

You might just have to turn off update fields on print.

elaineada75
05-14-2019, 06:08 PM
Hi Greg
It doesnt seem to work, the added text will not even stay.
How about if i add in another field, like asking the user is they are ready to generate the document? if yes, then unlink? But then I do not know how to write the VBA? Pl help.

gmaxey
05-15-2019, 06:14 AM
Well personally I would do away with the field code.