Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

formattedtext is not a reference error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gloeng - 31 Jan 2005 12:53 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
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.