Tag: Excel

When creating Word documents that should be reused as a template it is easy to use custom Word document properties. Those custom properties can be used as fields in a Word document. So when you need to create a new document with different values there are two ways.

First you can use CTRL + H (find and replace) to search through your document and find and replace values. This may be easy for documents where there are only a few changes needed.

Second you can use custom properties and fields within Word. By changing the custom properties and updating all the fields (CTRL + A and update) it is a very convenient way of changing larger numbers of custom properties.

I am using the second method for some years now but in some situations with a lot of custom document properties the interface is not the easiest way to go. Especially when you have information that needs to go into the Word document that can be created in an Excel sheet.

With PowerShell I am now able to read all the custom properties from an Excel sheet and add or update them to a Word file.

The PowerShell script askes for the Excel file, the Word file and it asks which sheet from the Excel file must be used.

Check the attached script to learn something of PowerShell or use it to your advance.

There is a small bug in PowerShell when it comes to opening and closing Excel files. Therefore you need to save and close all Excel files on your computer before you start the script. Otherwise some data loss may be possible. Sorry for that, I did not find a solution for this small bug on the Internet.