473,231 Members | 1,850 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,231 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 3920
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: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.