J
jamiee
Okay, I have some code which is deleting text at 6 different bookmark
points. I want to just delete the text, and not the bookmarks. For
some reason the first text at the first bookmark along with it's
bookmark is deleted when the code is executed, however the remaining
bookmarks remains. The code is exactly the same for each bookmark so I
don't understand why the first bookmark is deleted but the others
remain. Does anyone have any ideas why this is?
If I set the count value for the first deletion to 3, 3 characters are
deleted but the bookmark is deleted as well, even though some of the
text remains. Does anyone know what has gone wrong? or better still
how to correct this?
Private Sub Delete_Address()
With ActiveDocument
.Bookmarks("StdAdd1").Select
Selection.Delete Unit:=wdCharacter, Count:=6
.Bookmarks("StdAdd2").Select
Selection.Delete Unit:=wdCharacter, Count:=6
.Bookmarks("StdAdd3").Select
Selection.Delete Unit:=wdCharacter, Count:=7
.Bookmarks("StdAdd4").Select
Selection.Delete Unit:=wdCharacter, Count:=26
.Bookmarks("StdAdd5").Select
Selection.Delete Unit:=wdCharacter, Count:=24
.Bookmarks("StdAdd6").Select
Selection.Delete Unit:=wdCharacter, Count:=18
End With
End Sub
points. I want to just delete the text, and not the bookmarks. For
some reason the first text at the first bookmark along with it's
bookmark is deleted when the code is executed, however the remaining
bookmarks remains. The code is exactly the same for each bookmark so I
don't understand why the first bookmark is deleted but the others
remain. Does anyone have any ideas why this is?
If I set the count value for the first deletion to 3, 3 characters are
deleted but the bookmark is deleted as well, even though some of the
text remains. Does anyone know what has gone wrong? or better still
how to correct this?
Private Sub Delete_Address()
With ActiveDocument
.Bookmarks("StdAdd1").Select
Selection.Delete Unit:=wdCharacter, Count:=6
.Bookmarks("StdAdd2").Select
Selection.Delete Unit:=wdCharacter, Count:=6
.Bookmarks("StdAdd3").Select
Selection.Delete Unit:=wdCharacter, Count:=7
.Bookmarks("StdAdd4").Select
Selection.Delete Unit:=wdCharacter, Count:=26
.Bookmarks("StdAdd5").Select
Selection.Delete Unit:=wdCharacter, Count:=24
.Bookmarks("StdAdd6").Select
Selection.Delete Unit:=wdCharacter, Count:=18
End With
End Sub