![]() |
#1
|
||||
|
||||
![]()
While parsing I get three different string and I want to format them as below.
.Text = "Title" (style = heading 2) & vbcr .text = strtxtT(style = heading 3) & vbcr .text = StrtxtD(style = normal, bold = False) .text = strtxtN(style = normal, bold = True) |
#2
|
||||
|
||||
![]()
I've already provided you with code to format parts of a string in this thread:
https://www.msofficeforums.com/word-...tion-bold.html Applying Styles is no different.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
![]()
Ok. I tried but I think The problem is with paragraphs.
Recorded macro and found that Code:
.Style = ActiveDocument.Styles("Heading 2") |
#4
|
||||
|
||||
![]() Quote:
Your code could be reduced to: Code:
.Style = "Heading 2"
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
![]()
I think because s my code was from the HTML it was having some paragraphs which was disturbing the overall pattern. I split the string with paragraphs and solved the problem.
Thanks, for suggesting neat code. |
![]() |
Tags |
vba |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to do multiple find and replace in string. | PRA007 | Word VBA | 2 | 01-06-2016 09:10 PM |
Multiple Hyperlink to a single string | PRA007 | Word VBA | 7 | 11-09-2015 04:29 PM |
![]() |
PRA007 | Word VBA | 2 | 10-17-2015 01:07 AM |
How do I string together multiple copies of the same template in Office 2011 for Mac? | terrymarks | Word | 1 | 06-14-2015 10:21 PM |
inserting a string of data into an MS Word table??? | matto | Word VBA | 0 | 07-16-2010 09:35 AM |