Table Macro

A

Al

This may be asking too much but here goes

I need a macro to insert a Paragraph Mark at the end of each table cell

I have tried looking for examples of code but so far no luck

Thanks
Al
 
J

Jay Freedman

Al said:
This may be asking too much but here goes

I need a macro to insert a Paragraph Mark at the end of each table
cell

I have tried looking for examples of code but so far no luck

Thanks
Al

If any of the following is still a mystery, post back and point to what you
don't understand.

Sub AddParaToEachCell()
Dim myTable As Table
Dim myCell As Cell
Dim myRange As Range

For Each myTable In ActiveDocument.Tables
For Each myCell In myTable.Range.Cells
Set myRange = myCell.Range
With myRange
' move the end of the range to
' the spot between the last
' character and the cell marker
.MoveEnd wdCharacter, -1

' collapse the range to that spot
.Collapse wdCollapseEnd

' insert a paragraph mark
.Text = vbCr
End With
Next
Next
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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