PDM – Mapping Variables to Microsoft Word

Article by Izaaz Sheikh updated December 13, 2012

Article

EPDM variables can be mapped to a Microsoft Office document, automatically populating documents such as ECN’s (Engineering Change Notices).

1) In this article, the appropriate variable used will be Affects, and it has been configured for Word and Excel file types.

Screenshot 2025 05 03 125744

2) The Variable has been mapped to the data card.Data card

If you are not familiar with how this done, please refer to the SolidWorks Enterprise PDM Administration Guide.

3) In order for the variable to be mapped to the Word document, we must first define the Custom Property, in Word. From the menu bar, in Word select the File tab.

Screenshot 2025 05 03 130255
Select Info and then Advanced Properties from the Properties pull-downScreenshot 2025 05 03 130547

Click on the Custom Tab to add or select a custom property. Link to Content may not be selectable, but it is not required. Click Add, to create/define the Custom Property and OK, to exit Properties.

Screenshot 2025 05 03 131703
4) To display the custom property in the Office document, a Field needs to be inserted. From the “Insert” tab, select QuickParts icon and select Field

Quick Parts

From Categories, select DocProperty and in the Field Properties, select the Property you want to link to the field.

Field

After you click OK, you should have a value of your custom property in your Word document.

Screenshot 2025 05 03 131223

When you save and close the Word Document, you will see the custom property value updated in the file data card for this word document. 

Screenshot 2025 05 03 131452

Updating Fields

In order to update the field, you can press F9 when the document is open or add a refresh macro.

To create a refresh macro with an office document open, press Alt-F8 on your keyboard and select “Create”.

Update fields

 

In the Macro window, enter the text shown below.

06 05 2019 01 38 42

Sub AutoOpen ()

‘ AutoOpen Macro

Dim aStory As Range

Dim aField As Field

For Each aStory In ActiveDocument.StoryRanges

For Each aField In aStory.Fields

aField.Update

Next aField

Next aStory End Sub

 

Save and close the Visual Basic, to complete the macro.

Related Links

Want to do more with SOLIDWORKS PDM?

Our Certified SOLIDWORKS PDM Experts can help you to:

Find Related Content by TAG:

Izaaz Sheikh