Search code examples
automationms-officeoffice-2007word-2007

How to Automatically "Reset to Quick Styles from XYZ Template" in Word 2007?


In Word 2007, a user may update the applied styles by selecting the "Reset to Quick Styles from XYZ Template" in the Change Styles menu option.

Reset to Quick Styles from XYZ Template

Does anyone know of a way to automate this? I tried adding a macro to the Document_Open() method in the VBA for the Template project, but it errors out.


Solution

  • When you record a macro of the 'Reset to Quick Styles from xxx Template', Word generates the VBA code:

    WordBasic.ApplyQFSetTemplate
    

    I couldn't get this command to work either, nor find anything Word VBA docs about it. Instead, use the following command when the correct template is attached:

    ActiveDocument.UpdateStyles
    

    That one does work consistently!