#1
|
|||
|
|||
Can Excel be used to generate a seperate Word document?
Hi,
I want to create a document and the content will be based on different articles of pre-defined text and only the articles that appear are the ones that are checked at the beginning. I basically am creating a training guide but not all the information needs to be displayed for different people reading the document so I want them to be able to decide what they will see at the start of the document. Does anyone know if this is possible? Thanks in advance. |
#2
|
|||
|
|||
Look into AutoText and the AutoTextList field.
Automated Boilerplate Using Microsoft Word AutoTextList field - How to add pop-up lists to any Word document, so you can click your way through changes in seconds Otherwise, you might want to use a UserForm launched upon document creation from your template with a checklist. Create a Simple Userform Create & Employ a Userform |
#3
|
|||
|
|||
Thanks
Hi Charles, Many thanks for your speedy reply! I will have a look at all of these options now. One other think, If I am able to create auto text/macros, will these be usable on my PC only or will they still work if the document is saved and used on a different PC? Thanks again!
|
#4
|
|||
|
|||
Whether macros will work on another's PC depends on the rules on that PC. To have any chance, they need to be stored in your template. AutoText and other Building Blocks can only be stored in templates. Macros can be stored in either .docm or .dotm files.
For a userform to work on someone else's computer, you would use an AutoOpen macro to display the userform when a new document is created based on the template. The userform would then fill in the new document depending on the user choices, perhaps from AutoText. AutoText, and the AutoTextList field require no macros. |
#5
|
|||
|
|||
Thank you so much for this. I've started to build the template and it's looking good so far. Mind if I ask another question? The pieces of information that I am creating for the Building Blocks are details on certain modules from a system I use. Which building blocks are selected are based upon the decisions that a user makes in an existing Excel document. My plan would be that they would fill in their excel document and then use this to manually decide which building blocks are needed via the userform. Do you know if there is a way to link the two together so that once an excel sheet is filled in this acts as the userform and will then populate the document using the building blocks? Hope I've explained that well enough. I know what I want, just not how to describe it!!! Thanks again, you have been a great help.
|
#6
|
|||
|
|||
I believe that this can be done. It is beyond my competence, though. I do very little programming in Excel. I would suggest posting here: Word VBA Forum
I suspect I would create the UserForm in Excel and have it manipulate the Word objects. |
#7
|
|||
|
|||
Thank you Charles, you have been an unbelievable help! Take care.
|
#8
|
|||
|
|||
Can Excel be used to generate a seperate Word document?
Hi, I have an excel spreadsheet that will be used to select what modules a user would like training on. I have created information for each module in word as a building block. Is it possible to automatically generate a Word document using the building blocks based on decisions made in Excel? Thanks in advance.
Last edited by Charles Kenyon; 07-12-2016 at 10:46 AM. Reason: Note, I merged the previous Word thread into here. |
#9
|
||||
|
||||
You can do this either from Excel or from Word. Which is better rather depends on what you propose the users are going to do with the worksheet. If they are not making changes to the worksheet but merely making selections in a userform from data on the worksheet, then I would do it all in Word. If they are making changes to the worksheet and creating a document based on those changes, then I would do it in Excel. Either way you create a document from your template and write values to it from the worksheet (or based on the worksheet).
There are two functions available from my web site that will help. The xlFillList function at http://www.gmayor.com/Userform_ComboBox.html will read the worksheet into a userform list box or combo box from where a user can make suggestions. The box in question will be multi column so all the data required from each record is in the box, so you can process the selected record from the data in the columns of the box. The other function is the FillBM function at http://www.gmayor.com/useful_vba_functions.htm which can be used to write a value from the userform to a bookmark in the document. Working from Excel, you can read the values directly from the worksheet, but the fillBM function will need modifying to work with the specific document you are creating and not ActiveDocument. The code to create a document from Excel would be Code:
Dim wdApp As Object Dim wdDoc As Object On Error Resume Next Set wdApp = GetObject(, "Word.Application") If Err Then Set wdApp = CreateObject("Word.Application") End If On Error GoTo 0 Set wdDoc = wdApp.Documents.Add(Template:="C:\Path\TemplateName.dotx") 'Do stuff with wdDoc
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Importing Data from seperate closed excel file | KingoftheKassel | Excel Programming | 1 | 06-10-2016 08:34 AM |
generate and save document versions with different print areas | schroedercn | Word | 1 | 05-20-2014 06:01 AM |
Generate Excel Speadsheet from Access, Web, or??? | chrisalter | Excel | 0 | 07-12-2011 01:04 PM |
generate unique number on same document when printed | benjii19 | Word | 1 | 03-08-2011 12:38 AM |
Cannot generate 2003 Excel reports in IIS7 | sword.fish | Excel | 0 | 02-22-2010 01:43 PM |