We have used Word’s QuickStyleSets successfully since Word 2007. Now using Word 2016, I’ve run into a problem. “Index 1.dotx” is a QS Set which we store in the QuickStyle folder and apply using VBA. The code is as shown below:
Sub Index() ActiveDocument.ApplyQuickStyleSet “Index 1” AddStylesToGallery End Sub
The issue is that the first line runs and then the code exits. The second line of code (a macro in the same module, AddStylesToGallery) does not run. There is no error. If I use F8 to step through the code, the first line runs, and then the code jumps out of the Sub. I can run AddStylesToGallery successfully as a separate macro.
The QS Set has 5 styles in the Style Gallery which I want copied to the active document. That executes as expected, and those 5 styles then become the ONLY styles in the Style Gallery. This is as expected. But I want our other commonly used styles to appear in the Style Gallery, and the AddStylesToGallery macro does that when executed on its own. But it will not execute if it follows the ApplyQuickStyleSet method. I’ve used ApplyQuickStyleSet2, which is current for Word 2016. Both methods produce the same results.
Any ideas?
Thanks.