Thread: [Solved] Set paragraph text to bold.
View Single Post
 
Old 09-04-2012, 11:08 AM
gmaxey gmaxey is offline Windows XP Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Something like this and I didn't see the underline bit until after I had composed the code. You should get the jist:

Sub ScratchMacro()
'A quick macro scratch pad created by Greg Maxey
Dim i As Long
Dim oRng As Word.Range
Dim arrDemo(2, 2) As String
arrDemo(0, 0) = "Category A"
arrDemo(0, 1) = "Item 1"
arrDemo(0, 2) = "Size A"
arrDemo(1, 0) = "Category B"
arrDemo(1, 1) = "Item 1"
arrDemo(1, 2) = "Size B"
arrDemo(2, 0) = "Category C"
arrDemo(2, 1) = "Item 1"
arrDemo(2, 2) = "Size C"
For i = 0 To UBound(arrDemo)
ActiveDocument.Range.InsertAfter vbCr
Set oRng = ActiveDocument.Paragraphs.Last.Range
oRng.MoveEnd wdCharacter, -1
oRng.Text = arrDemo(i, 0)
oRng.Font.Bold = True
oRng.Collapse wdCollapseEnd
oRng.Text = " " & arrDemo(i, 1)
oRng.Font.Bold = False
oRng.Collapse wdCollapseEnd
oRng.Text = " " & arrDemo(i, 2)
Next i
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote