Formatted text on a Word2007 userform

L

Lori L.

Is there any way for VBA to place formatted text on a region of a userform?
A control? Or perhaps a way of inserting a Word object?

By formatted text, I mean that some of the characters are bold AND some
aren’t; some are red AND others are green, etc.
I’d prefer to use VBA because Word 2007 is already approved for use, and any
other software package might take weeks or months to get approved, but if it
can’t be done with VBA, can it be done with Visual Basic?

Word 2007 on XP and/or Vista
 
P

Pesach Shelnitz

Hi Lori,

You can insert formatted text in a specific region by saving it as an
autotext entry, creating a bookmark for the region, and inserting the
autotext entry into the bookmark. In Word 2007, when you create autotext, by
default, it is created as a building block and saved in the Building Blocks
template. If you assign a building block to the autotext gallery and save it
in the Normal template or your own template, you can use any coding that
works for autotext in Word 2003.

In Word 2007, building blocks that are saved in the default Building Blocks
template are accessed through the Templates(1).BuildingBlockEntries property.
The following code inserts a building block called MyAutotext into a bookmark
called MyRegion.

Templates(1).BuildingBlockEntries("MyAutotext").Insert _
Where:=ActiveDocument.Bookmarks("MyRegion").Range, _
RichText:=True
 
L

Lori L.

I know how to place a bookmark in a DOCUMENT, but I don't see how i would
place a bookmark/autotext/buidingblock/etc on a VBA USERFORM (created with
the Visual Basic editor).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top