Sub
BearbeiteWordDatei(filePath
As
String
, templateDocPortrait
As
Document, templateDocLandscape
As
Document)
Dim
doc
As
Document
Dim
orientation
As
String
Dim
rngTmp
As
Range, lngTmp
As
Long
Dim
template
As
Document
Dim
headFoot
As
HeaderFooter
Set
doc = Documents.Open(filePath)
orientation = doc.PageSetup.orientation
With
doc.Sections(1).Footers(wdHeaderFooterPrimary)
Select
Case
doc.PageSetup.orientation
Case
wdOrientPortrait
Set
template = templateDocPortrait
Case
wdOrientLandscape
Set
template = templateDocLandscape
End
Select
Set
headFoot = template.Sections(1).Footers(wdHeaderFooterPrimary)
headFoot.Range.Copy
.Range.Paste
Do
While
.Range.StoryLength > headFoot.Range.StoryLength
Set
rngTmp = .Range
rngTmp.Start = rngTmp.
End
- 1
lngTmp = rngTmp.StoryLength
rngTmp.Delete
If
rngTmp.StoryLength = lngTmp
Then
Exit
Do
End
If
Loop
End
With
With
doc.PageSetup
If
.FooterDistance = 42.55
Then
.FooterDistance = CentimetersToPoints(0.4)
End
If
End
With
doc.Save
doc.Close SaveChanges:=
False
Set
doc =
Nothing
End
Sub