Consulting

Results 1 to 4 of 4

Thread: Only user form to appear & template to close if the user form is exited.

  1. #1

    Only user form to appear & template to close if the user form is exited.

    Hi All,

    I am after some assistance to do one of either:

    1) Only the user form shows up when the template is opened; and

    2) If a user exits the user form (by pressing the 'x') i want the template document to also close. If they don't run the user form then the document has not populated correctly. I have found code so that when the user form is exited Microsoft Word will close. However, as the whole application is closing, it also closes ALL other word documents i have open. i only want it to close the document not the application.

    Thanks again in advance

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Your post is ambiguous. Your refer to both a template being opened and a template document being closed, yet the latter seems to refer to a document based on the template, not the template itself.

    When you close all documents based on a template, the template, too, is unloaded (closed).

    As for the code you're using, we can't comment on that or suggest any particular change without seeing it.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Hi Paul,

    Sorry this is a follow on from the above.

    I have a userform document that i have saved as a .dotm. On my computer it works fine. When i open the template, the userform pops up and then when i run the userform, the underlying document then creates a .doc file which is what i want it to do.

    However, when i send the template to others, it opens as a 'read only' and thus once the userform runs, it still remains a .dotm. The issue here is that once someone saves it, when the document is reopened, the user form pops up again.

    Essentially what i am trying to do is once the userform is run, someone can save the populated document and reopen it without the userform popping up again.

    do you have any suggestions?

    Thanks in advance

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Your description suggests the 'others' are opening the template for editing instead of creating a new document from it. Presumably, that's because they opened it from your email attachment instead of saving the attachment then double-clicking on the saved file.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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