I'm using Word 2000 to produce an output document from a VB application.

I'm fine inserting text, images etc at bookmarks within a Word template
file, but when I insert text which contains HTML tags, these are inserted as
plain text rather than HTML. For instance you end up seeing "<B>Bold
Here</B>" rather than just a bolded formatting of the words "Bold Here"

Word 2000 can obviously handle HTML, because if you paste in text copied
from a browser, you get it rendered as HTML rather than plain text.

I'm using code like this to insert the text:

Word.Application.ActiveDocument.Bookmarks.Item("IntroParagraph").Range.Text=
"<B>Bold Here</B>"

Suggestions gratefully received!
Thanks, John

Re: Automation: Inserting HTML text into Word 2000 by Jonathan

Jonathan
Tue Aug 03 06:12:46 CDT 2004

Hi John,

The Text property of a range is just that - text. If you want to format the
text then you'll have to strip off the tags and apply the formatting as
separate VBA commands.

Alternatively, if you can get the formatted text you want loaded onto the
clipboard and you can then insert it using the Paste method. But it is not a
simple matter of loading up text with tags into the clipboard and then
expecting Windows to magically realise that the tags are formatting rather
than the text you inserted.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

"John" <johnremovethedash-oxenbridge@hotmail.com> wrote in message
news:uRwYwEUeEHA.556@tk2msftngp13.phx.gbl...
> I'm using Word 2000 to produce an output document from a VB application.
>
> I'm fine inserting text, images etc at bookmarks within a Word template
> file, but when I insert text which contains HTML tags, these are inserted
as
> plain text rather than HTML. For instance you end up seeing "<B>Bold
> Here</B>" rather than just a bolded formatting of the words "Bold Here"
>
> Word 2000 can obviously handle HTML, because if you paste in text copied
> from a browser, you get it rendered as HTML rather than plain text.
>
> I'm using code like this to insert the text:
>
>
Word.Application.ActiveDocument.Bookmarks.Item("IntroParagraph").Range.Text=
> "<B>Bold Here</B>"
>
> Suggestions gratefully received!
> Thanks, John
>
>