View Single Post
 
Old 06-19-2017, 08:09 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You can of course create your own functions, but for it to work correctly with the add-in you need to follow the format set out on the web page - in particular the items commented below. Different Word versions use style sets differently, but if the recorder gives the style set name as you have it it will probably work in your version.

Code:
Function changeStyle(oDoc As Document) As Boolean
    On Error GoTo Err_Handler
    'Do Something with oDoc here. e.g.,"
    oDoc.ApplyQuickStyleSet2 ("Template")
    changeStyle = True 'the name of the function = true
lbl_Exit:
    Exit Function
Err_Handler:
    changeStyle = False 'the name of the function = false
    Err.Clear
    GoTo lbl_Exit
End Function
You can also apply individual styles to the header footer ranges (or parts of the ranges) in the original macro, but the styles should be stored in the autotext entries and so this should be unnecessary. The problem will be that you have different styles with the same names in the target documents, so you could copy the styles used in your autotexts from the normal template to the document, which can be done in the same macro or perhaps better still use unique style names for your header and footer in the autotext so there is no conflict.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote