What if I don't know how much data is following the bookmark? I'd like to be able to clear whatever went in there, so that the doc is ready for the next set of data.
Thanks!
Al
Helmut Weber wrote:
Re: Clear text after a bookmark
24-Mar-07
Hi Colin,
so many ways,
delete 15 characters after a bookmark:
Sub Test400()
Dim lng As Long
Dim rng As Range
Set rng = ActiveDocument.Bookmarks("fax_no").Range
With rng
For lng = 1 To 15
.Characters.Last.Next = ""
Next
End With
End Sub
Maybe, but not me.
The only thing I can say is that I prefer thick books.
Visit:
http://word.mvps.org/index.html
HTH
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Previous Posts In This Thread:
Clear text after a bookmark
can anybody help me with some code for MS word 2003. I want to clear the
text / characters/ numbers after a bookmark leaving the bookmark intact.
.Bookmarks("Fax_no").Select
Selection.MoveRight Unit:=wdCharacter, Count:=15, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
this is the code i have sussed out so far, the only thing is it deletes the
line and the bookmark which i don't wish to do.
Can anybody help?
Also can anybody recommend a book for word VBA as i find the MS online help
manual useless?
Cheers
Colin
See my response to your post in the customization newsgroup.
See my response to your post in the customization newsgroup. Please do not
post the same question separately to multiple newsgroups.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Re: Clear text after a bookmark
Hi Colin,
so many ways,
delete 15 characters after a bookmark:
Sub Test400()
Dim lng As Long
Dim rng As Range
Set rng = ActiveDocument.Bookmarks("fax_no").Range
With rng
For lng = 1 To 15
.Characters.Last.Next = ""
Next
End With
End Sub
Maybe, but not me.
The only thing I can say is that I prefer thick books.
Visit:
http://word.mvps.org/index.html
HTH
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
EggHeadCafe - Software Developer Portal of Choice
ASP.NET Color Tool Derived from Reflection
http://www.eggheadcafe.com/tutorial...04-bb778fb8bfb7/aspnet-color-tool-derive.aspx