![]() |
|
#1
|
|||
|
|||
|
Hi Folks,
Another trip to the well for a Word VBA Newb... I have VBA code which opens a Word instance and programmatically populates the document with tables. However, each table must have a title, so my code is: Code:
Selection.Text = " Product Specifications"
Selection.Font.Name = "calibri"
Selection.Font.Size = 16
Selection.Font.Bold = True
Selection.EndKey Unit:=wdStory
'Now add table...
.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:=4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
Code:
Selection.Text = " Product Specifications"
Selection.Font.Name = "calibri"
Selection.Font.Size = 16
Selection.Font.Bold = True
Selection.Font.Underline = wdUnderlineSingle
Selection.EndKey Unit:=wdStory
'Now add table...
.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:=4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
Of course, when I do, everything in the document after that line is underlined. I only want the titles underlined. What am I doing wrong, please? Thanks, -John |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replacing a comment with underline or other formatting (or adding that formatting to commented text) | paulkaye | Word | 4 | 05-16-2016 05:38 AM |
Is there a way of having text automatically inserted based on the selection of other text?
|
MiniMum97 | Word | 2 | 04-12-2016 06:09 AM |
| Copy Underline text from Word and Paste into excel | rfaris | Excel Programming | 7 | 10-05-2015 05:56 AM |
Select text to be underline and bold
|
ksigcajun | Word VBA | 1 | 03-16-2015 07:51 PM |
| How to remove the UNDERLINE from a hyperlink text? | Learner7 | PowerPoint | 3 | 05-17-2010 09:35 PM |