Share via

UserForm Template to Create Multiple Documents

Anonymous
2013-08-15T23:10:54+00:00

I created a template that has several documents within the Template.  The template has a Userform that has input fields to populate the documents.  We were able to submit the document as a single document.  Now there has been a change and each document must be submitted individually.Let me explain more clearly if I can:

Template1 is a 12 page document template with a userform to populate the fields.

Pages 1-4 of Template1 is Document1, pages 5-7 is Document2, pages 8-10 is Document3, and pages 11-12 is Document4.

We used to be able to send Template1 and everything was OK, the receiving site would break down the documents individually.  But now, the receiving site is requiring us to submit each document separately.  So Document1, Document2, Document3, and Document4 must be sent individually.

Each Document1-Document4 has similar information in them (i.e. Name, phone number, address, date of birth).  It would be a real pain to have to create 4 different document templates and input the same sets of data 4 times.  It is also a pain to cut/paste each document and then same separately.

Here is my question...finally.  Is there a way to create a template where we only have to input the data set one time in the UserForm and all 4 separate documents will be created from the information?

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2013-08-17T01:29:01+00:00

    I can't seem to send any email to you.  It is being rejected by the server.  

    I removed your email address from the error below.  I have tried to send from both my computer and from my ipad, but it gets rejected by the mvps.org server.

    Here is the error:

    Final-Recipient: rfc822;(email address removed)

    Action: failed

    Status: 5.7.1

    Diagnostic-Code: smtp;554 5.7.1 Invalid HELO Format .

    Remote-MTA: dns;mail.mvps.org

    X-Display-Name: (email address removed)

    Thanks.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-08-16T23:51:30+00:00

    Sent.

    Thank you for your courtesy and help.

    Was this answer helpful?

    0 comments No comments
  3. Doug Robbins - MVP - Office Apps and Services 323K Reputation points MVP Volunteer Moderator
    2013-08-16T22:29:20+00:00

    If you send me the template, I will check it out.

    You can decipher my email address from my signature or obtain it from my profile.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-08-16T16:25:46+00:00

    Doug,

    Thank you for the info.  I still can't get it to work.  Here is what I did:

    1.  I opened Template1 and added section breaks to each document contained in Template1.  There were a total of four (4) section breaks.

    2.  I opened the Visual Basic window and selected the UserForm and then View Code.  At the end of the code I added your VBA above.  I then saved the code and Template1.

    3.  I closed Word completely and then ran the Template I modified with the section breaks and the code.

    Unfortunately, it did nothing.  I tried to add the code to the actual Template rather than the UserForm but that did not work either.

    This problem has given me fits.  What did I do wrong?  Or what else should I consider.  I'd be glad to send you the template if that would help.

    Thanks.

    Was this answer helpful?

    0 comments No comments
  5. Doug Robbins - MVP - Office Apps and Services 323K Reputation points MVP Volunteer Moderator
    2013-08-16T00:21:11+00:00

    Two ways to go about it:-

    Have  macro in the UserForm that after populating the 12 pages with the required information, split the document into the four parts, which would probably be best done by having a section break between each of the parts and then using code such as that in the following macro

    Sub splitter()

    ' splitter Macro

    ' Macro created by Doug Robbins to save each letter created by a mailmerge

    ' as a separate file, retaining the header and footer information.

    Dim i As Long, Source As Document, Target As Document, Letter As Range

    Set Source = ActiveDocument

    For i = 1 To Source.Sections.Count

        Set Letter = Source.Sections(i).Range

        Set Target = Documents.Add

        Target.Range = Letter

        Target.Sections(2).PageSetup.SectionStart = wdSectionContinuous

        Target.SaveAs FileName:="Letter" & i

        Target.Close

    Next i

    End Sub

    The second way would be to save a template containing the user form in the Word Startup Folder so that it was treated as an add-in and create a separate template for each of the four documents and have code in the user form create new documents from each of the templates, populating each with the data that was inserted into the form and then saving each one in turn.

    Was this answer helpful?

    0 comments No comments