Bold & other font attributes 
Author Message
 Bold & other font attributes

Hi- I have a Word template where i have inserted a
DOCVARIABLE called "remarks". This remarks field can be
rather lengthy. Can I make a word or two appear in BOLD or
ITALICS when it "merged" into the document? (I do not want
the entire remarks field to be bold or italics, just a
word or two, so I do not want to make DOCVARIABLE in the
Word template bold.)

For example, the remarks may be: "Please enclose a copy of
your birth certificate when mailing in the forms." Here I
would want "birth certificate" to be bold.   OR   "Be sure
to cross at the green, not in between." Here I would
want "green" in italics.   This is to say that the entire
remarks change and I cannot say that the 5th word should
be bold or that the 11th word should be italics. This
changes with each remark.

It seems to me that I need a code of some kind to put in
the vb code behind the template form. It would be nice if
it were as easy as:  "Be sure to cross at the
BOLDONgreenBOLDOFF and not in between." But life is never
so easy.

Thanks in advance for your help.
-Marty



Fri, 23 Sep 2005 22:36:56 GMT  
 Bold & other font attributes
Sorry,

I omitted a rather important line in the suggested routine:

With Selection
    .HomeKey unit:=wdStory
    With .Find
        .ClearFormatting
        .Text = "(XXX)(*)(XXX)"
        .MatchWildcards = True
        With .Replacement
            .ClearFormatting
            .Font.Bold = True
            .Text = "\2"
        End With
        .Execute Replace:=wdReplaceAll
    End With
End With


Quote:
> Hi- I have a Word template where i have inserted a
> DOCVARIABLE called "remarks". This remarks field can be
> rather lengthy. Can I make a word or two appear in BOLD or
> ITALICS when it "merged" into the document? (I do not want
> the entire remarks field to be bold or italics, just a
> word or two, so I do not want to make DOCVARIABLE in the
> Word template bold.)

> For example, the remarks may be: "Please enclose a copy of
> your birth certificate when mailing in the forms." Here I
> would want "birth certificate" to be bold.   OR   "Be sure
> to cross at the green, not in between." Here I would
> want "green" in italics.   This is to say that the entire
> remarks change and I cannot say that the 5th word should
> be bold or that the 11th word should be italics. This
> changes with each remark.

> It seems to me that I need a code of some kind to put in
> the vb code behind the template form. It would be nice if
> it were as easy as:  "Be sure to cross at the
> BOLDONgreenBOLDOFF and not in between." But life is never
> so easy.

> Thanks in advance for your help.
> -Marty



Fri, 23 Sep 2005 23:54:41 GMT  
 Bold & other font attributes
Hi Marty,

We do something similar. We build a document from a database and need to
have special formatting for certain words. We use something like XXXPhrase
to be boldedXXX and then use a wildcard search and replace.

With Selection
    .HomeKey unit:=wdStory
    With .Find
        .ClearFormatting
        .Text = "(XXX)(*)(XXX)"
        With .Replacement
            .ClearFormatting
            .Font.Bold = True
            .Text = "\2"
        End With
        .Execute Replace:=wdReplaceAll
    End With
End With

HTH


Quote:
> Hi- I have a Word template where i have inserted a
> DOCVARIABLE called "remarks". This remarks field can be
> rather lengthy. Can I make a word or two appear in BOLD or
> ITALICS when it "merged" into the document? (I do not want
> the entire remarks field to be bold or italics, just a
> word or two, so I do not want to make DOCVARIABLE in the
> Word template bold.)

> For example, the remarks may be: "Please enclose a copy of
> your birth certificate when mailing in the forms." Here I
> would want "birth certificate" to be bold.   OR   "Be sure
> to cross at the green, not in between." Here I would
> want "green" in italics.   This is to say that the entire
> remarks change and I cannot say that the 5th word should
> be bold or that the 11th word should be italics. This
> changes with each remark.

> It seems to me that I need a code of some kind to put in
> the vb code behind the template form. It would be nice if
> it were as easy as:  "Be sure to cross at the
> BOLDONgreenBOLDOFF and not in between." But life is never
> so easy.

> Thanks in advance for your help.
> -Marty



Fri, 23 Sep 2005 23:54:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How I change the item bold attribute at listview control

2. How to mix Symbol fonts with others?

3. help - ntsp3 killed tree control fonts, others

4. Bold Fonts in a SendObject command

5. VBA to change Footer Format - Fonts, Size, Bold etc

6. How to maintain Bold font and underline in Text replacement

7. Backcolor and Forecolor and Font.Bold

8. Rich Textbox Bold Monospaced font

9. Bold Fonts in Menus

10. Bold Font for some Nodes in a collection?

11. bold font in a treeview ??

12. Bold/regular font for Node/Listitem

 

 
Powered by phpBB® Forum Software