Consulting

Results 1 to 10 of 10

Thread: Sleeper: Help with AutoText

  1. #1

    Sleeper: Help with AutoText

    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=182...COhy1xR5A5CCjW

    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!

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    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?
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    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. TEST AUTOTEXT TEMPLATE.zip

  4. #4
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    See the attached
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

  5. #5
    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.

  6. #6
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    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
    Greg

    Visit my website: http://gregmaxey.com

  7. #7
    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.

  8. #8
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    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.
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

  9. #9
    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.

  10. #10
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    Well personally I would do away with the field code.
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •