Deleting <cr>

S

SoNew2This

With assistance from this posting board, I've been able to delete a table if
a certain cell is empty.

Dim oRng1 As Range

With ActiveDocument
Set oRng1 = .Range(Start:=.Bookmarks("BK_COLLS").Range.End, _
End:=.Bookmarks("BK_COLLE").Range.Start)
If Len(oRng1.Tables(1).Cell(2, 1).Range) = 2 Then
oRng1.Tables(1).Delete
GoTo lma
Else
Dim t1 As Table
Set t1 = ActiveDocument.Bookmarks("BK_COLL").Range.Tables(1)
End If
End With

This works swell. But I'd like to also delete the first and last carriage
returns which are the Start and End Bookmarks. How is this accomplished?

Thank you in advance.
 
H

Helmut Weber

Hi,

i'm not sure, if I understand your question right,
but for the first character in a bookmark's range:
ActiveDocument.Bookmarks("Test").Range.Characters.First = ""
For the last character respectively:
ActiveDocument.Bookmarks("Test").Range.Characters.Last = ""

You could also delete those characters,
but sometimes autocorrect settings redo deleting immediately.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top