#1
|
|||
|
|||
Underline word(s) over the whole page width using VBA
Hi,
If i type a word, or words, followed by a CR LF, followed by 3 consecutive underline characters, then is the result a full line under the typed word(s) stretching from the left side of the page to the right side of the page - see picture on the bottom of the message. This is not the same as underlining the word(s), the line spacing is also different as you can see in the picture. I would like to obtain this using VBA, but I'm not lucky at all. I record a macro, see code below, but this is only placing the 3 underline characters on a new line, not what I expected. How can this be done? I'm new with Word & VBA for Word, no experience at all. Ludo Code:
Sub Macro8() ' ' Macro8 Macro ' ' Selection.TypeText Text:="titel" Selection.TypeParagraph Selection.TypeText Text:="___" Selection.TypeParagraph End Sub |
#2
|
||||
|
||||
Use a paragraph border e.g.
Code:
Sub Macro1() Selection.TypeText Text:="titel" With Selection.ParagraphFormat.Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth150pt .Color = wdColorAutomatic End With End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Quote:
Works great. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to adapt a text pasted from PDF to the full width of a microsoft word page | Alessio | Word | 2 | 01-13-2018 03:35 PM |
Underline at bottom of page won't go away | yachts66 | Word | 3 | 08-13-2014 07:28 AM |
How do you delete the UNDERLINE from a Title that remains on The previous page. | Dane_s_13 | Word | 4 | 02-20-2013 04:55 PM |
Word 2012: Change column width changes table width | OpfinnarJocke | Word Tables | 1 | 09-22-2012 04:03 AM |
Word is inserting bold page-width lines without permission! | kozureokami | Word | 6 | 05-22-2011 02:59 PM |