473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Word Automation Error: ".FormattedText is not a by reference property"

NOTE: This was posted earlier to vsnet.vstools.office under a different
subject line but received no response.

I'm having a problem automating Word's Find object from a .NET application,
using late binding.

If I use early binding, my code runs fine on most systems, but it is
vulnerable to a known bug explained here:
http://support.microsoft.com/default...b;en-us;292744

The workaround to the bug is to use late binding instead of early binding,
but late binding has a problem of its own. The problem strikes me as a
generic automation problem and not a .NET interop problem.

I started with the following early-bound code:

Dim rngSource as Word.Range = wdDoc.Range.Paragraphs.Item(1).Range
Dim rngDestination as Word.Range = wdDoc.Range.Paragraphs.Item(2).Range
rngDestination.FormattedText = rngSource.FormattedText

After reading the above-referenced article, I switched to late-bound code as
follows:

Dim rngSource as Object = wdDoc.Range.Paragraphs.Item(1).Range
Dim rngDestination as Object = wdDoc.Range.Paragraphs.Item(2).Range
rngDestination.FormattedText = rngSource.FormattedText

NOTE: wdDoc is declared and instantiated elsewhere in my code and is NOT the
source of the problem.

When the late-bound code runs, I get the following error:

".FormattedText is not a by reference property"

Can anyone suggest how to access the .FormattedText property (and other "not
by reference" properties) of a late-bound object? Within .NET, is there some
way to use Reflection to access such properties?

Bill Coan
bi******@wordsite.com
Nov 21 '05 #1
4 3933
Hi,

have you tried:

x = rngSource.FormattedText
rngDestination.FormattedText = x

Maybe this helps.
Greets, Helmut Obertanner
"Bill Coan" <bi******@wordsite.com> schrieb im Newsbeitrag
news:OL**************@TK2MSFTNGP15.phx.gbl...
NOTE: This was posted earlier to vsnet.vstools.office under a different
subject line but received no response.

I'm having a problem automating Word's Find object from a .NET
application, using late binding.

If I use early binding, my code runs fine on most systems, but it is
vulnerable to a known bug explained here:
http://support.microsoft.com/default...b;en-us;292744

The workaround to the bug is to use late binding instead of early binding,
but late binding has a problem of its own. The problem strikes me as a
generic automation problem and not a .NET interop problem.

I started with the following early-bound code:

Dim rngSource as Word.Range = wdDoc.Range.Paragraphs.Item(1).Range
Dim rngDestination as Word.Range = wdDoc.Range.Paragraphs.Item(2).Range
rngDestination.FormattedText = rngSource.FormattedText

After reading the above-referenced article, I switched to late-bound code
as follows:

Dim rngSource as Object = wdDoc.Range.Paragraphs.Item(1).Range
Dim rngDestination as Object = wdDoc.Range.Paragraphs.Item(2).Range
rngDestination.FormattedText = rngSource.FormattedText

NOTE: wdDoc is declared and instantiated elsewhere in my code and is NOT
the source of the problem.

When the late-bound code runs, I get the following error:

".FormattedText is not a by reference property"

Can anyone suggest how to access the .FormattedText property (and other
"not
by reference" properties) of a late-bound object? Within .NET, is there
some way to use Reflection to access such properties?

Bill Coan
bi******@wordsite.com

Nov 21 '05 #2
Hi Helmut,
x = rngSource.FormattedText
rngDestination.FormattedText = x
Thanks for taking a stab at this. I tried your idea, to no avail. With x
declared as Object, the first line runs but the second triggers the error
that has plagued me from the beginning.

Fellow VB-types have been so bereft of ideas that I may have to drop into a
CSharp group and see if someone there can at least explain how the process
is breaking down, even if there's nothing that can be done about it.

Bill Coan
bi******@wordsite.com
"Helmut Obertanner" <ob********@datalog.de> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Hi,

have you tried:

x = rngSource.FormattedText
rngDestination.FormattedText = x

Maybe this helps.
Greets, Helmut Obertanner
"Bill Coan" <bi******@wordsite.com> schrieb im Newsbeitrag
news:OL**************@TK2MSFTNGP15.phx.gbl...
NOTE: This was posted earlier to vsnet.vstools.office under a different
subject line but received no response.

I'm having a problem automating Word's Find object from a .NET
application, using late binding.

If I use early binding, my code runs fine on most systems, but it is
vulnerable to a known bug explained here:
http://support.microsoft.com/default...b;en-us;292744

The workaround to the bug is to use late binding instead of early
binding, but late binding has a problem of its own. The problem strikes
me as a generic automation problem and not a .NET interop problem.

I started with the following early-bound code:

Dim rngSource as Word.Range = wdDoc.Range.Paragraphs.Item(1).Range
Dim rngDestination as Word.Range = wdDoc.Range.Paragraphs.Item(2).Range
rngDestination.FormattedText = rngSource.FormattedText

After reading the above-referenced article, I switched to late-bound code
as follows:

Dim rngSource as Object = wdDoc.Range.Paragraphs.Item(1).Range
Dim rngDestination as Object = wdDoc.Range.Paragraphs.Item(2).Range
rngDestination.FormattedText = rngSource.FormattedText

NOTE: wdDoc is declared and instantiated elsewhere in my code and is NOT
the source of the problem.

When the late-bound code runs, I get the following error:

".FormattedText is not a by reference property"

Can anyone suggest how to access the .FormattedText property (and other
"not
by reference" properties) of a late-bound object? Within .NET, is there
some way to use Reflection to access such properties?

Bill Coan
bi******@wordsite.com


Nov 21 '05 #3
Hi Bill,
I'm having a problem automating Word's Find object from a .NET application,
using late binding.

If I use early binding, my code runs fine on most systems, but it is
vulnerable to a known bug explained here:
http://support.microsoft.com/default...b;en-us;292744

Have you seen this KB article:
http://support.microsoft.com/default...b;en-us;313104

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Nov 21 '05 #4
> Have you seen this KB article:
http://support.microsoft.com/default...b;en-us;313104
Hi Cindy,

Thanks, but this is essentially the same article as the one I referenced in
my question. No new information there. Both articles /recommend/ late
binding, which is the cause of the problem I'm trying to solve.

A number of fellow MVPs have offered some useful suggestions for further
research. I will post back here after I've had an opportunity to complete my
research.

Bill Coan
bi******@wordsite.com
"Cindy M -WordMVP-" <C.*********@hispeed.ch> wrote in message
news:VA.0000a84d.0044e3fc@speedy... Hi Bill,
I'm having a problem automating Word's Find object from a .NET
application,
using late binding.

If I use early binding, my code runs fine on most systems, but it is
vulnerable to a known bug explained here:
http://support.microsoft.com/default...b;en-us;292744

Have you seen this KB article:
http://support.microsoft.com/default...b;en-us;313104

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert | last post by:
---EN--- This message has been crossposted in a french speaking newsgroup, english version is at the end. Thanks a lot for your help... --/EN--- Bonjour, Je développe une application...
0
by: howie | last post by:
I've upgraded a vb6 application to vb .net and am having an issue. whenever I try to set the recordset property of the VB6.adodc object in .net and run the application I get the error “object...
1
by: G Fernandes | last post by:
Scope is a property of identifiers and defines where they are visible in a source file. Why then do most writings on C also use the word "scope" to refer to a property of different points of a...
2
by: jdanoz | last post by:
Hello, i have a vb.net project with a reference to an ActiveX object (ocx). If i try to use the ocx from vb6 project (adding the reference) it works ok (using CreateObject). In vb.net, the...
0
by: pinky | last post by:
Hi all I am having one web service where in at a time of calling one webmethod through client application i am continuously getting following error :- The underlying connection was...
1
by: dasayu | last post by:
Hi, I have a custom object called gridWidget. I am consistantly getting an error in FireFox when I click on an href, which calls a function defined on the object. The generated link looks similar...
3
by: jbeteta | last post by:
Hello, I have a problem declaring variables. I need to create an object oRpte as ReportClass on WebForm1.aspx and be able to use its value on WebForm2.aspx. For declaring the property oRpte()...
9
by: billelev | last post by:
I have the following vba code that returns the "date modified" field from a file, specified in filepath: Function GetFileModifiedDate(filepath As String) As Date Dim fs, f Set fs =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.