VBA word - Delete all lines in paragraph in table

Hi guys,

i'm trying to figure out a way to delete entire all lines inserted into a cell in a table, and i feel like it have tried almost everything.

kindly help.

What i do is, i use this line to go to the BM:
Selection.GoTo What:=wdGoToBookmark, Name:="HBomktekst"

Open in new window


then i tried to use this line:
ActiveDocument.Bookmarks("HBomktekst").Range.Paragraphs(1).Range.Delete

Open in new window


the thing is that the lines are flexible so at times its 4 lines at times its 8 and at times its 1...

it does delete but only the first line....

is there a way?
LVL 1
HakumAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MacroShadowCommented:
The following code will select and then delete the second cell in the first row, amend to match your needs.
ActiveDocument.Tables(1).Cell(1, 2).Select
Selection.Delete

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HakumAuthor Commented:
Thanks alot! sadly for some reason it did not work for me, even that it should! although i figured out a workaround, by selecting a range between 2 bookmarks and deleting that instead.

Set rngStart = ActiveDocument.Bookmarks("Start").Range
Set rngEnd = ActiveDocument.Bookmarks("slut").Range

ActiveDocument.Range(rngStart.Start, rngEnd.End).Select

Selection.Delete

Open in new window

GrahamSkanRetiredCommented:
If you only want to delete a particular paragraph, you can do it like this (for the first paragraph in the call):
ActiveDocument.Tables(1).Cell(1, 1).Range.Paragraphs(1).Range.Delete

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.