watkins77
09-12-2013, 09:46 PM
I am trying to change the font size and color of text within a single cell of a table as below.
Cell 1-1 - Line one
Cell 1-1 - Line two
I can't seem to define the range to only be used for a specific text, therefore anything in that cell gets the same font style! :banghead:
My example code is below - any help would be much appreciated.
Set objRange = objSelection.Range
objDoc.Tables.Add objRange, 1, 1
Set objTable = objDoc.Tables(1)
With objTable.Cell(1, 1)
.Shading.BackgroundPatternColor = RGB(245,245,245)
Set rng = .Range
rng.Font.Color = RGB(255,0,0)
rng.Font.Name = "Arial"
rng.Font.Size = "12"
rng.Font.Bold = True
rng.InsertAfter "Cell 1-1 - Line one"
rng.InsertAfter Chr(11)
rng.Font.Color = RGB(0,0,255)
rng.Font.Name = "Arial"
rng.Font.Size = "16"
rng.Font.Bold = False
rng.InsertAfter "Cell 1-1 - Line two"
End With
Cell 1-1 - Line one
Cell 1-1 - Line two
I can't seem to define the range to only be used for a specific text, therefore anything in that cell gets the same font style! :banghead:
My example code is below - any help would be much appreciated.
Set objRange = objSelection.Range
objDoc.Tables.Add objRange, 1, 1
Set objTable = objDoc.Tables(1)
With objTable.Cell(1, 1)
.Shading.BackgroundPatternColor = RGB(245,245,245)
Set rng = .Range
rng.Font.Color = RGB(255,0,0)
rng.Font.Name = "Arial"
rng.Font.Size = "12"
rng.Font.Bold = True
rng.InsertAfter "Cell 1-1 - Line one"
rng.InsertAfter Chr(11)
rng.Font.Color = RGB(0,0,255)
rng.Font.Name = "Arial"
rng.Font.Size = "16"
rng.Font.Bold = False
rng.InsertAfter "Cell 1-1 - Line two"
End With