Linking MS Word Document Properties to PDM Variables
Tips and Tricks • Amgad Yacoub • 10 February 2021
Most MS documents can be controlled and linked to Solidworks PDM, as per the following instructions.
- In PDM Administration Tools –> Variables node, define PDM variable (Description)
- Define PDM variable New Attribute (CustomProperty)
- Define Block name (CustomProperty)
- Define Attribute Name (Description)
- Link to file extension (Doc, Docx,…etc.)
- Link Variable to data Card
- DataCard should Support File extensions
Let us test the result.
Create i.e., an MS word file in PDM and updated the DataCard field Description with a value (This Field Controlled by PDM)
Open the MS word file go to file Info –> Properties.
Select Advance Properties a Custom tab.
You should see all the DataCard values in the properties box.
- But how to show this information in the document body?
Go to Insert Tab –> Quick Part –> Field.
From Filed name select DocProperty and then select Description from the right list
This Filed Controlled by PDM Modified
Save the file and close the file check it in check it out again modify the DataCard Variable (Description) value this Field Controlled by PDM Modified (this is the result after modifying the DataCard value 😊)
- For auto-update these values, copy and paste the following macro in the word document:
Go to the Developer tab –> Macros
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
This should be it 😊.
Note: The best practise is to have a predefine word document templates stored in PDM Vault and use the PDM Templates functionality to create these word documents.
By this, once you right-click in PDM Vault view –> Create a Project Checklist for example, and start filling this document’s DataCard values. The word document will be created with the Datacard information already in the document body as per the following example.
Hope that helps.
Amgad Yacoub
Senior Field Engineer
Central Innovation, Perth
At Central Innovation, we can provide all – or part – of the solution. Including SOLIDWORKS, ARCHICAD, and many more industry-leading tools.
It’s something we’ve been doing for almost 30 years. Our commitment to customer service is second to none: we help you get the best out of your technology.
For a truly unique solution to your unique challenges, please contact us. Or read about some of the great services and solutions we offer.