问题
I have an Excel file with a list of names as follows:
*--------------------------------------*
| Last, First Middle | email@site.edu |
*--------------------------------------*
All email addresses are "@site.edu"
I have a Word file like this
Dear <name>,
...
Is there a way to automatically save a copy of the Word document with the name cell inserted over and save the file as "email" where "email" is the email address without site.edu?
I would also like to change to be First Middle Last, but I can handle that by saving the Excel as .CSV and using a text editor with regular expressions. I just don't know enough about the capabilities of Office to know if this is possible to automate.
回答1:
It sounds like you just need to use Word's mail merge feature, which will allow you to use the Excel list as a source file for the salutation names and will create a personalized letter/document for each row. They could then print the whole merged document.
回答2:
you can do alot with JScript, obviously only targeting Windows/IE. You can access your documents via IE too. http://msdn.microsoft.com/en-us/library/7sw4ddf8(v=vs.85).aspx this link has a function for manipulating an Excel document, there's also a section for Word. http://www.thescriptlibrary.com/Default.asp?Action=Display&Level=Category3&ScriptLanguage=VBScript&Category1=Microsoft%20Office&Category2=Microsoft%20Excel&Title=Add%20Formatted%20Data%20to%20a%20Spreadsheet i'm sure you can put them together into what ya need. sorry for not doing it for ya, i hate opening up Office documents.
来源:https://stackoverflow.com/questions/7425093/save-a-new-word-document-for-each-row-in-excel