I'm automating Word2003 in VB.Net. I'm using late binding.
I want to put another document's content into the selected area of the
active document, without loosing its formatting.
I'm getting a 'formattedtext is not a reference property' error with the
following code
... Selection.FormattedText = doc.Content.FormattedText ...
If this is a bug, does someone know another statement to achieve the same
result.
I'd like not to use clipboard.

Signature
thanks, gloeng
Jezebel - 31 Jan 2005 13:53 GMT
It's not a bug. You just can't use the FormattedText property in that way,
because FormattedText is a Range object. There's no easy alternative to
copying the range.
in VBA (no idea what the VB.Net equivalent is) --
doc.content.copy
selection.paste
> I'm automating Word2003 in VB.Net. I'm using late binding.
> I want to put another document's content into the selected area of the
[quoted text clipped - 7 lines]
> result.
> I'd like not to use clipboard.
Helmut Weber - 31 Jan 2005 16:21 GMT
Hi Jezebel,
hmm.. I wonder, as this seems to work well here and now.
Selection.FormattedText = Documents(1).Content.FormattedText
documents(2) is activated, of course.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Jonathan West - 31 Jan 2005 16:40 GMT
> I'm automating Word2003 in VB.Net. I'm using late binding.
> I want to put another document's content into the selected area of the
[quoted text clipped - 7 lines]
> result.
> I'd like not to use clipboard.
It's not a bug, it's a syntax error. Try this
Selection.FormattedText = doc.Content
Or if you don't want to both with opening the document prior to inserting
its content, try using the InsertFile method instead

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