473,748 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

NOTE: This was posted earlier to vsnet.vstools.o ffice 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.Par agraphs.Item(1) .Range
Dim rngDestination as Word.Range = wdDoc.Range.Par agraphs.Item(2) .Range
rngDestination. FormattedText = rngSource.Forma ttedText

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

Dim rngSource as Object = wdDoc.Range.Par agraphs.Item(1) .Range
Dim rngDestination as Object = wdDoc.Range.Par agraphs.Item(2) .Range
rngDestination. FormattedText = rngSource.Forma ttedText

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:

".Formatted Text 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******@wordsi te.com
Nov 21 '05 #1
4 3967
Hi,

have you tried:

x = rngSource.Forma ttedText
rngDestination. FormattedText = x

Maybe this helps.
Greets, Helmut Obertanner
"Bill Coan" <bi******@words ite.com> schrieb im Newsbeitrag
news:OL******** ******@TK2MSFTN GP15.phx.gbl...
NOTE: This was posted earlier to vsnet.vstools.o ffice 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.Par agraphs.Item(1) .Range
Dim rngDestination as Word.Range = wdDoc.Range.Par agraphs.Item(2) .Range
rngDestination. FormattedText = rngSource.Forma ttedText

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

Dim rngSource as Object = wdDoc.Range.Par agraphs.Item(1) .Range
Dim rngDestination as Object = wdDoc.Range.Par agraphs.Item(2) .Range
rngDestination. FormattedText = rngSource.Forma ttedText

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:

".Formatted Text 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******@wordsi te.com

Nov 21 '05 #2
Hi Helmut,
x = rngSource.Forma ttedText
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******@wordsi te.com
"Helmut Obertanner" <ob********@dat alog.de> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hi,

have you tried:

x = rngSource.Forma ttedText
rngDestination. FormattedText = x

Maybe this helps.
Greets, Helmut Obertanner
"Bill Coan" <bi******@words ite.com> schrieb im Newsbeitrag
news:OL******** ******@TK2MSFTN GP15.phx.gbl...
NOTE: This was posted earlier to vsnet.vstools.o ffice 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.Par agraphs.Item(1) .Range
Dim rngDestination as Word.Range = wdDoc.Range.Par agraphs.Item(2) .Range
rngDestination. FormattedText = rngSource.Forma ttedText

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

Dim rngSource as Object = wdDoc.Range.Par agraphs.Item(1) .Range
Dim rngDestination as Object = wdDoc.Range.Par agraphs.Item(2) .Range
rngDestination. FormattedText = rngSource.Forma ttedText

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:

".Formatted Text 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******@wordsi te.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******@wordsi te.com
"Cindy M -WordMVP-" <C.*********@hi speed.ch> wrote in message
news:VA.0000a84 d.0044e3fc@spee dy... 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
8872
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 intranet qui "tourne" maintenant depuis plusieurs années auprès de 2500 personnes environ, mais depuis 1 mois,
0
1300
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 reference not set to an instance of an object†this is what the code looks like Dim lador_JLD As New ADODB.Recordset ls_sql = "execute sp_ShiftEditJobsDetail " Dim Gdf_cpv As Object
1
1433
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 source file. For example, "the function call has a prototype in scope.." should really be "the function call is in the scope of a prototype." Points in source files don't have scopes, they are withing scopes of declarations. How come almost all...
2
8443
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 CreateObject works ok, the object gets initialized...
0
1584
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 closed: An unexpected error occurred on a
1
2301
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 to: javascript:gridWidget.editColumn(3, 3, 'PDDSectionForm', 'pdd_link', ..) The above works fine in IE.
3
2266
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() on WebForm1.aspx, I use "Public Property" and I declare variable _oRpte as Friend Shared. That's my problem. If I don't declare _oRpte as Friend Shared, I can't use WebForm1.oRpte() on other webpage. If I declare _oRpte as Friend Shared, I can use...
9
21358
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 = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile(filepath) GetFileModifiedDate = f.datelastmodified
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.