Somewhat simpler and, perhaps, more effective:
Code:
Sub Document_Open()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
Select Case Split(LCase(.Name), ".")(1)
Case "txt", "log"
For i = 1 To Application.Templates.Count
If Application.Templates(i).Name = "Normal.dotm" Then
.AttachedTemplate = Application.Templates(i)
Exit For
End If
Next
.PageSetup.PaperSize = .AttachedTemplate.PageSetup.PaperSize
.PageSetup.Orientation = wdOrientLandscape
.PageSetup.TopMargin = CentimetersToPoints(0.6)
.PageSetup.BottomMargin = CentimetersToPoints(0.6)
.PageSetup.LeftMargin = CentimetersToPoints(0.6)
.PageSetup.RightMargin = CentimetersToPoints(0.6)
.Range.Font.Size = 10
End Select
End With
Application.ScreenUpdating = True
End Sub
For PC macro installation & usage instructions, see:
Installing Macros
For Mac macro installation & usage instructions, see:
Word:mac - Install a Macro