L
LEU
I was looking at all the table questions last night and found a macro written
by Lene Fredborg that does almost what I am looking for. What I’m looking for
is how to go to the 5 text location in the cell and copy the rest of the text
(which would very in length) in that cell. The macro below will only get the
second text item.
Dim strWord1 As String
Dim oBkRange As Range
Dim strBk1 As String
'Define bookmark names
strBk1 = "bkTitle"
With ActiveDocument.Sections(1).Range.Tables(2)
'Trim removes trailing spaces
strWord1 = Trim(.Cell(1, 4).Range.Words(2).Text)
End With
'Update bookmark text
'Bookmarks must be added again
With ActiveDocument
Set oBkRange = .Bookmarks(strTitle).Range
oBkRange.Text = strWord1
'Add bookmark again
.Bookmarks.Add Name:=strBk1, Range:=oBkRange
End With
Set oBkRange = Nothing
by Lene Fredborg that does almost what I am looking for. What I’m looking for
is how to go to the 5 text location in the cell and copy the rest of the text
(which would very in length) in that cell. The macro below will only get the
second text item.
Dim strWord1 As String
Dim oBkRange As Range
Dim strBk1 As String
'Define bookmark names
strBk1 = "bkTitle"
With ActiveDocument.Sections(1).Range.Tables(2)
'Trim removes trailing spaces
strWord1 = Trim(.Cell(1, 4).Range.Words(2).Text)
End With
'Update bookmark text
'Bookmarks must be added again
With ActiveDocument
Set oBkRange = .Bookmarks(strTitle).Range
oBkRange.Text = strWord1
'Add bookmark again
.Bookmarks.Add Name:=strBk1, Range:=oBkRange
End With
Set oBkRange = Nothing