Hi.
so habe ich auch gedacht, aber ich bekomme es nicht hin
Kannst du mir helfen?
So sieht es gerade bei mir aus.
Es funktioniert soweit ganz gut. Er springt immer zur Textmarke, ABER das löschen funktioniert nicht.
(Hier wir nur ein Blatt eingefügt, es kommen normalerweise mehrere)
- Code: Alles auswählen
Public Sub Anlagenblaetter()
Word.Selection.GoTo What:=wdGoToBookmark, Name:="Anlagen"
If ActiveDocument.Bookmarks.Exists("Anlagen") Then
ActiveDocument.Bookmarks("Anlagen").Delete
End If
ActiveDocument.Bookmarks.Add Name:="Anlagen", Range:=Selection.Range
' Neue Anlagenseite
If UserForm3.TextBox1.Text <> "" Then
Selection.InsertNewPage
Selection.TypeParagraph
Selection.Font.Size = 14
ActiveDocument.FormFields.Add(Range:=Selection.Range, Type:=wdFieldFormTextInput).Name = "Anlage11Text"
With Selection.ParagraphFormat
.SpaceBefore = 400
.SpaceAfter = 6
.Alignment = wdAlignParagraphRight
End With
ActiveDocument.FormFields("Anlage11Text").Result = UserForm3.TextBox1
Selection.TypeParagraph
Selection.Font.Size = 22
ActiveDocument.FormFields.Add(Range:=Selection.Range, Type:=wdFieldFormTextInput).Name = "Anlage11Kapitel"
Selection.ParagraphFormat.SpaceBefore = 120
ActiveDocument.FormFields("Anlage11Kapitel").Result = "Anlage 1.1"
End If
End Sub