Results 1 to 3 of 3

Thread: Basic userform on update removing bookmarks from doc

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    1

    Basic userform on update removing bookmarks from doc

    Dear All,
    This is probably an obvious one I’m missing. I have created a basic userform on a dotm that consists of 7 text boxes to make stock labels basically.
    The userform posts the text to the document and then prints it, I then have a reset button that blanks the text boxes for re-input but the previous data now seems to have saved into the document and update button fails as it can’t find the bookmarks? Basically because the document still has the last data in them. Bookmarks are gone?
    I have tried removing the print option in case it is doing the save?
    I’m using ActiveDocument.Printform which works.
    I also tried amending the reset button to unload and reload the userform it doesn’t change the outcome either?
    I guess it’s something staring me in the face? But I’m scratching my head.
    The document itself has fields that I have the bookmarks around could this be the issue?
    Any help would be much appreciated.
    Thanks!

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,140

    Re: Basic userform on update removing bookmarks from doc

    Welcome.

    You are much, much more likely to get assistance when you post the actual code you are using rather than a description of what it is doing. Also, if you can attach an example document file that exhibits the described behavior, you are again more likely to get help.

    Good luck.

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Basic userform on update removing bookmarks from doc

    sounds like you opening and adding information to the template
    you should be opening a NEW document, based on the specific template
    Code:
    Set doc = Documents.Add(somepath & mytemplatename)
    each time you reset the textboxes you could close the previous document with or without saving, then open another new document

    Bookmarks are gone?
    it is possible to keep the bookmarks, but generally they are replaced by the data inserted

    I’m using ActiveDocument.Printform which works.
    i am not sure why it should work as .printform is not a method of a document object
    there is ,printout and .printformsdata, but neither is what you specified and forms data is not related to a userform, but a document with formfields
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width