Creating Multiple Word Documents

I am going to be creating a Word document with a table in it for each of 400 math topics.  I will fill in the tables later.   I want to name the documents whatever their topic name is.  I have all the topic names in a spreadsheet.  

I was hoping to use a document containing the table as a template and somehow create all 400 Word documents named as the topic names.  Can someone help me do  that?

A mail merge is a possibility but the filenaming may need to be manual which won't be fun over 400 files.

Are all the topic names suitable for file names or do they include invalid filename characters such as \ ?

If you post sample docs with the Word content and the spreadsheet with a few topics in it we can develop a macro to do this quickly.

Andrew Lockton
Melbourne Australia

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If you create and Excel data source that contains in one of its fields the filenames that you want to use, you can use Mail Merge with the Merge to Individual Document facility on the

MergeTools – 20140218 Add-in that I created that you can download from the following page of my One Drive:

http://bit.ly/1fJ5GTj

Save the file in the Word Startup folder.  In Windows Vista and Windows 7, 8 or 8.1 ,the default location for that folder is:

C:\Users\[User Name]\AppData\Roaming\Microsoft\Word\STARTUP

When you have done that, the tab shown below will be added to the Ribbon:

One thing to note is that the field names in your data source must contain only alphanumeric characters (No @,#,$,%,&,(,), etc) and the field names must not start with a numeric character (0-9).

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If your names are all in one column in the worksheet and you use Word's mailmerge feature to use the worksheet as a data source (via Mailings>Select Recipients>use existing list), you could then use a macro like the following to generate the individual files:

Sub Generate_Topic_Files()
'Merges one record at a time to the chosen output folder
Application.ScreenUpdating = False
Dim StrFolder As String, StrName As String, MainDoc As Document, i As Long
Set MainDoc = ActiveDocument
With MainDoc
  StrFolder = .Path & "\"
  For i = 1 To .MailMerge.DataSource.RecordCount
    With .MailMerge
      .Destination = wdSendToNewDocument
      .SuppressBlankLines = True
      With .DataSource
        .FirstRecord = i
        .LastRecord = i
        .ActiveRecord = i
        StrName = .DataFields("Topic_Name")
      End With
      .Execute Pause:=False
    End With
    With ActiveDocument
      .SaveAs2 FileName:=StrPath & StrName & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
      .Close SaveChanges:=False
    End With
  Next i
End With
Application.ScreenUpdating = True
End Sub

where 'Topic_Name' is the column heading in your worksheet. Each file will be saved with that name in the same folder as your existing document. If you want the Topic_Name to appear in the document as well, simply insert a mergefield for it at the appropriate location(s).

For macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm

Cheers
Paul Edstein
(Fmr MS MVP - Word)

5 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I'll do my best to explain this simply.  I am creating word documents for each of hundreds of topics.  Each topic has a unique name, however, I have also assigned IDs for the topics to make them easier to work with.

I plan to have a word document where I do a screen-recording of me working "my" problem step-by-step (with a separate recording for each step) on the left side of the document.  I have created a table that will contain two problems, one on each side.  I work down the left side and then have the students work their problem down the right side.  See the screenshot, below.

I then hope to put the tables and videos into OneNote where each topic has its own Section.  I think that will make it easier for the student to work there and save their work, as well as it being easy to download these assignments as OneNote sections.

Below, I will show my spreadsheet, where I am working with the topic, "Converting a percentage into a fraction in simplest form".  I enter the "steps" in the spreadsheet and then have them merge into the table.  In my table screenshot, above, I used an image for the problem statements.  I will probably be adding a column in my spreadsheet for problem statements, however, I don't know what to do if the problem statement has an image associated with it.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

The approach I suggested will work for this, though you might want to change:

StrName = .DataFields("Topic_Name")
to something like:

StrName = .DataFields("ID") & " - " & .DataFields("Topic_Name")

so as to facilitate sorting the files by ID

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks, Macropod.  I am looking at the macro from your other post and am not sure what line I should be changing.  I don't see a line with StrName= in it.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

There's only one 'StrName = .DataFields("Topic_Name")' line in the other post; that's the one to replace.
Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks, Macropod, I found it.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated May 7, 2024 Views 6,557 Applies to: