Hallo,
bin jetzt soweit, dass ich mir diesen Code rausgesucht habe, der sollte eigentlich für mein Vorhaben reichen:
Sub Vorlagen_Wort_ersetzen_Word2010()
Dim anzdatei As Integer
Dim Pfad As String
Dim Datei As String
Dim Schutz As Boolean
Dim i As Long
Dim a As Long
Dim fs As New Collection
Schutz = False
Pfad = InputBox(„Geben Sie den Pfad an“, „Pfad“)
If Right(Pfad, 1) „“ Then Pfad = Pfad & „“
Datei = Dir(Pfad, vbDirectory)
If Datei = „“ Then
MsgBox „kein Ordner oder Dateien!“
Exit Sub
End If
Do While Datei „“
If Datei „.“ And Datei „…“ Then
If (GetAttr(Pfad & Datei) And vbDirectory) vbDirectory Then
If Right(Datei, 4) = „dotm“ Or Right(Datei, 4) = „dotx“ Then
fs.Add Pfad & Datei
End If
End If
End If
Datei = Dir
Loop
anzdatei = fs.Count
For i = 1 To anzdatei
WordBasic.DisableAutoMacros 1
Documents.Open fs(i)
If ActiveDocument.ProtectionType wdNoProtection Then
Schutz = True
'Array für den Dokumentenschutz der Abschnitte
ReDim strArray(ActiveDocument.Sections.Count)
'Array einlesen
For a = 1 To ActiveDocument.Sections.Count
If ActiveDocument.Sections(a).ProtectedForForms = True Then
strArray(a) = 1
Else
strArray(a) = 0
End If
Next
'Dokumentenschutz aufheben
ActiveDocument.Unprotect
End If
'hier wird Test in den Dokumenten gesucht und geändert
Dim MyStoryRange As Word.Range
For Each MyStoryRange In ActiveDocument.StoryRanges
With MyStoryRange.Find
.ClearFormatting
.Text = „Bolardusstraße“
With .Replacement
.ClearFormatting
.Text = „neuer Text“
End With
.Execute Replace:=wdReplaceAll, _
Format:=True, MatchCase:=True, _
MatchWholeWord:=True
End With
Next MyStoryRange
If Schutz = True Then
For a = 1 To ActiveDocument.Sections.Count
If strArray(a) = 1 Then
ActiveDocument.Sections(a).ProtectedForForms = True
Else
ActiveDocument.Sections(a).ProtectedForForms = False
End If
Next
'Dokumentenschutz wieder einschalten
ActiveDocument.Protect Password:="", NoReset:=True, Type:=wdAllowOnlyFormFields
End If
'Dokument wird gespeichert und geschlossen
ActiveDocument.Save
ActiveDocument.Close
WordBasic.DisableAutoMacros 0
Next i
MsgBox „Es wurden " & anzdatei & " Datei(en) neu gespeichert!“
End Sub
Ab dem 'hier wird Test in den Dokumenten gescuht und geändert, möchte ich folgende Funktion einbauen:
ActiveWindow.View.SeekView = wdSeekCurrentPageFooter
Selection.WholeStory
Selection.PasteAndFormat (wdFormatOriginalFormatting)
Ich weiß allerdings nicht, wie ich das da einbauen kann, dass das funktioniert.
Das Suchen und Ändern kann raus und ich möchte einfach nur meine Funktion dafür da drin haben.
Vielleicht kannst du mir ja helfen?
Wäre dir für jede Hilfe dankbar, da ich nicht sooo super in VBA bin. 
Gruß