Reputation: 371
code segment
String1 = "the quick brown" & " fox " & "jumped over..."
With wdoc.Tables(pos)
.Rows(1).Cells(1).Range.Text = String1
End with
OK Simple enough - assign string and then assign string to cell.
What I would like to do is tell the word " fox " he is bold. Can this be done? Is there a special character sequence? for example ^B, does anyone know where the complete list can be found? The text can obviously be anything...
thanks and regards Seán
Upvotes: 2
Views: 1214
Reputation: 19077
I can propose only a workaround for what you need- as far as I know there isn't any simple solution for such a thing. Please see some comments and explanation inside the code.
'put each part of your text into array,
'No white-spaces inside quotation marks
String1 = Array("the quick brown", "fox", "jumped over...")
'let's change With structure a bit:
With wDoc.Tables(pos).Rows(1).Cells(1)
'put text to table as a result of Joining all array elements
.Range.Text = Join(String1, " ")
'assuming you want to bold 2nd element of your text/array which ever long it is
'we search range within document which refers to this part of our text
'which could be done in this way:
wDoc.Range( _
.Range.Start + Len(String1(0)), _
.Range.Start + Len(String1(0)) + Len(String1(1)) + 1). _
Font.Bold = True
End With
and the result looks as presented below:
Upvotes: 1