A family of Microsoft word processing software products for creating web, email, and print documents.
The first example includes the second example, when the "With ActiveDocument" is combined with the ".AttachedTemplate = ..." However, the first example includes a lot more.
Installing a template as an add-in and also making it the document's attached template is fairly unusual, because the macros, shortcuts, and user interface customizations that would be supplied by an add-in are also things that are available from the attached template. The attached template also supplies styles, which add-ins do not supply.
Setting the ActiveDocument.UpdateStylesOnOpen = True applies the template's style definitions to overwrite any differently defined styles of the same names in the document. Setting it to True and leaving it that way could be dangerous if some other template (such as the Normal.dotm) is attached later and contains different style definitions, as the updating could cause unwanted reformatting.
The .XMLSchemaReferences properties will prevent saving the document if it fails validation against an attached XML schema (this is rather uncommon).