Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 01-20-2017, 09:54 PM
gmayor's Avatar
gmayor gmayor is offline Underline Inserted Text Windows 10 Underline Inserted Text Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

My point was that styles are the best way of formatting text. i.e. format (say) Heading 2 style to be 16 point Calibri Bold, Underlined and apply that to the paragraph that is the table title.

Using VBA you have to identify the variable texts to be formatted and you have not explained enough to be able to do that however ....

If the table title is the paragraph immediately before each table then

Code:
Sub U_LineTableTitles()
Dim oRng As Range
Dim oTable As Table
    For Each oTable In ActiveDocument.Tables
        Set oRng = oTable.Range.Previous.Paragraphs(1).Range
        With oRng
        .Font.Name = "Calibri"
        .Font.Size = 16
        .Font.Bold = True
        .Font.Underline = wdUnderlineSingle
        'Or instead of the font commands
        '.Style = "Heading 2"
        .Collapse 0
        End With
    Next oTable
End Sub
As you have not explained how the tables and their titles are created then it is not possible to be specific about how to format the titles in your original code.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



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
Underline Inserted Text 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
Underline Inserted Text 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft