forked from mattretzer/Word-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttach Template Macro
56 lines (46 loc) · 1.47 KB
/
Attach Template Macro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Sub zz_AttachStyleTemplate()
''''''''''''''''''''''''''''''''
'''created by Matt Retzer - matthew.retzer@macmillan.com
'''version 2.0
'''last updated 5/20/14
Dim TheOS As String
Dim myFile As String
Dim myFilePC As String
Dim myFileMac As String
TheOS = System.OperatingSystem
myFilePC = "C:\ProgramData\MacmillanStyleTemplate\macmillan.dotm"
myFileMac = "Macintosh HD:Users:Shared:MacmillanStyleTemplate:macmillan.dotm"
'Set template path according to OS
If Not TheOS Like "*Mac*" Then
myFile = myFilePC 'I am Windows
Else
myFile = myFileMac 'I am a Mac
End If
'Apply template with Styles
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = myFile
End With
End Sub
Sub zz_AttachBoundMSTemplate()
'''copy of Sub zz_AttachStyleTemplate()
'''but to attach a template without color guides
Dim TheOS As String
Dim myFile As String
Dim myFilePC As String
Dim myFileMac As String
TheOS = System.OperatingSystem
myFilePC = "C:\ProgramData\MacmillanStyleTemplate\macmillan_NoColor.dotm"
myFileMac = "Macintosh HD:Users:Shared:MacmillanStyleTemplate:macmillan_NoColor.dotm"
'Set template path according to OS
If Not TheOS Like "*Mac*" Then
myFile = myFilePC 'I am Windows
Else
myFile = myFileMac 'I am a Mac
End If
'Apply template with Styles
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = myFile
End With
End Sub