+ Reply to Thread
Results 1 to 13 of 13

Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Doc

  1. #1
    Registered User
    Join Date
    09-22-2015
    Location
    Finland
    MS-Off Ver
    Office 2016
    Posts
    26

    Question Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Doc

    Hello again Forum Gurus!

    This thread is continuation of my earlier thread (Exporting UserForm data to Word)
    I'm working here with the same file. Please find the updated file and some additive files from the attachment:

    Combine multiple word-documents to a master document.zip

    Thank you LJMetzger aka Lewis, once more.


    Now I have a lot of different Word files which need to be chosen via a configurator (Userform checkboxes) and combined to a Master Word file (ExistingTemplate.docx). The idea is that each checkbox in this userform represents an unique word file.

    For Example: IF Gender = Male, Color = Green & Category = A.
    Then the files laying behind the "CheckBoxMale(=GenderMale.docx)", "CheckBoxGreen(=ColorGreen.docx)" and "CheckBoxA(=CategoryA.docx)", are combined to ExistingTemplate.doc.

    The combobox values can probably be easily linked to checkbox value (True/False) with "Case" command, I just didn't write the code for that in the attached file because it doesn't really matter at the moment, the focus should be on the checkboxes.

    All needed files can be found from the attachment. There's also an example in the ExistingTemplate.docx, how it should look like.
    I hope I stated this clearly enough

    Thx in advance!

    -ODeveloper

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi there,

    It's a bit hard to figure out exactly what you're asking for.

    Do you want to maintain the ComboBoxes and CheckBoxes working in parallel? The ComboBoxes allow only one selection per ComboBox, but your CheckBoxes allow multiple (e.g. male AND female) selections to be made.

    Am I missing something here?

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    09-22-2015
    Location
    Finland
    MS-Off Ver
    Office 2016
    Posts
    26

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi Greg,

    Sorry for the confusing explanation. I should have deleted those comboboxes from the userform. The idea is that the combobox values defines which checkboxes gets value = True.

    For example, If I choose these alternatives from the comboboxes:

    EFexample1.JPG

    Then these checkboxes gets value = True:

    EFexample.JPG

    This would just be a "pre-selection" and then you should be able to add more selections manually to comboboxes just by clicking them.
    However, I think I know how to do it with "Case" code, and that's not the issue. Sorry for being actually quite confusing with that :D

    So don't care about the comboboxes, I'm just intrested about how can I link those specific word-documents to specific checkboxes

    Example:

    CheckBoxMale should be linked to GenderMale.docx
    CheckBoxFemale should be linked to GenderFemale.docx

    CheckBoxGreen should be linked to ColorGreen.docx
    CheckBoxBlue should be linked to ColorBlue.docx
    .... and so on.

    All the data from the selected word-documents (= selected checkboxes) should then be exported to ExistingTemplate.docx

    Hope this made it a bit clearer?

    Thanks for you interest!

    -ODeveloper


    PS. I'm sorry but I also misspelled the TITLE OF THIS THREAD lol. It should say

    Choose multiple Word-Documents via UserForm CHECKBOX and combine them to Master Word-Do

    sorry!
    Last edited by ODeveloper; 10-13-2015 at 09:38 AM.

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi again,

    I enjoy working with UserForms, and this one is interesting!

    With luck I should be able to post something here either later tonight or tomorrow morning.

    Regards,

    Greg M

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Just curious, why is the userform in Excel instead of Word?
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    09-22-2015
    Location
    Finland
    MS-Off Ver
    Office 2016
    Posts
    26

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Nice to hear that you are interested Greg!

    Norie, do you think it would be easier to carry out via Word?

    This is part of a bigger project, where I have a configurator(UserForm) for different parameters to make 30-40page long Word documents. There will probably be hundreds of small unique Word documents which are used to build up the "Master" document. So that means that there is also going to be _many_ different variations how the Master doc can look like.

    -ODeveloper

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Userforms in Word are almost identical to those in Excel.

    The major difference, I suppose, is in Excel you can take data from the workbook to populate the controls, as you are currently doing.

    If you wanted to move everything to Word you would have to hard-code the data for the form.
    Last edited by Norie; 10-14-2015 at 11:08 AM.

  8. #8
    Registered User
    Join Date
    09-22-2015
    Location
    Finland
    MS-Off Ver
    Office 2016
    Posts
    26

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Sounds too difficult to me, since I've studied VBA just a bit more than a month now haha.. (no programming background)

    Thx for the tip anyway! I'm curious and will have to get familiar with userforms in word as well

    -ODeveloper

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    You could actually import the existing Excel userform into a Word document.

    See the updated template document.
    Attached Files Attached Files

  10. #10
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi again,

    Take a look at the attached workbook and see what you think.

    I've used OptionButtons instead of CheckBoxes to ensure that multiple selections (e.g. both Male and Female) cannot be made.

    I've concentrated on totally decoupling the UserForm from everything else in the workbook. (This means that the UserForm can be placed in a workbook that contains nothing else, and will still compile successfully.)

    A calling routine ("ShowForm") displays the UserForm, retrieves the values entered for Name, Gender, Colour and Category, and then passes them as arguments to the "ExportUserFormDataToWord" routine where they can be used in Search & Replace operations etc.

    It's worth noting that the ONLY place where these values are defined is in the captions of the OptionButtons on the UserForm - i.e. if you want to change Blue to Purple and Category A to African Antelope, the only place where you need to make these changes is in the Captions of the appropriate OptionButtons. This makes the UserForm that much more flexible and re-useable.

    I'm not exactly sure how you want to import the Gender, Colour and Category documents into your Master Template, but at least the ExportUserFormDataToWord routine now "knows" the values associated with the required documents.

    Hope this helps - please let me know how you get on, and feel free to ask if there's anything you need me to explain.

    Regards,

    Greg M



    P. S.

    Regarding Norie's Post #7:


    The major difference I suppose is in Excel you can take data from the workbook to populate the controls, as you are currently doing.

    If you wanted to move everything to Word you would have to hard-code the data for the form.


    Norie makes a valid point. The UserForm in my workbook could be imported into Word and the data are already "hard-coded" in the captions of the OptionButtons.
    Attached Files Attached Files
    Last edited by Greg M; 10-13-2015 at 06:44 PM. Reason: P. S. added

  11. #11
    Registered User
    Join Date
    09-22-2015
    Location
    Finland
    MS-Off Ver
    Office 2016
    Posts
    26

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi guys,

    and thanks for both of your efforts Greg and Norie! I will take a closer look on these files this evening and return tomorrow with comments!

    Regards,
    ODeveloper

  12. #12
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi again,

    I'll be away from tomorrow morning until Tuesday evening - hope to reply after that.

    Regards,

    Greg M

  13. #13
    Registered User
    Join Date
    09-22-2015
    Location
    Finland
    MS-Off Ver
    Office 2016
    Posts
    26

    Re: Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Do

    Hi there Guys!

    Norie, what is the actual benefit of moving the userform to word? There are already a tons of data in my excel workbook and more is coming, so I think that I will stick with my original work-around.

    Greg, that's a nice userform, but I think that it didn't really meet my needs. I can probably use that still later in my project, so thanks for that

    I've made another simplified example now with totally new workbook and userform. I will also start a new thread just to avoid confusing, since it has changed a bit on the way now.

    I hope this is not against the forum rules?

    Link to new thread: Export Userform CheckBox data to Word-template

    -ODeveloper

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Transfer Data From Excel to Word and Keep Bookmarks in Word Documents
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2015, 05:37 AM
  2. Content Control Dropdown - Master to use in MULTIPLE Word documents?
    By marsham in forum Word Formatting & General
    Replies: 2
    Last Post: 01-07-2015, 10:56 PM
  3. Split a single word document into multiple word documents
    By CaptainCool in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2014, 03:31 AM
  4. Batch Compile 100+ multiple word documents into a single word document
    By JamesFrames8 in forum Word Formatting & General
    Replies: 4
    Last Post: 04-03-2014, 08:49 PM
  5. Populating Word from excel and other word documents
    By Higham in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2013, 09:06 PM
  6. Word wrap in Textbox of Userform
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2011, 10:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1