473,749 Members | 2,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make a copy of a Word Range object

Is there any way to make a copy of a word.range object? I have a range in a
document and I need to monkey around with it but I don't want to change the
original in the document. I've tried Duplicate() and assigning it to a new
variable. But if I change the stuff in the new variable, it changes the
original also.

So what I need is a new copy of the variable - not pointing to the same
thing.

TIA - Jeffrey
Nov 20 '05 #1
1 6749
What exactly do you mean by "changing stuff"? As I understand it,
Duplicatae() returns a clone of the original range object.

If you modify the the text or formatting properties of the original range,
however, the duplicated range will also show the same change -- because the
change to the first range is actually changing the underlying Word document.
For example in this air code,

Dim FirstRange as Word.Range = Word.Selection. Range
Dim SecondRange as Word.Range = FirstRange.Dupl icate()
FirstRange.Text = "New text"

the text of SecondRange will also be changed to "New text" because the
underlying Word document has changed. The two range objects are merely
"pointers" (of sorts) for the content in the Word document itself.

However, if you make a change to a range that doesn't modify the document,
it should only affect that particular range object. For example, if you
have the line "FirstRange.Len gth = 0" it shouldn't change the length of
SecondRange.

Is this your issue, or is there something else? Perhaps you could post a
sample of code that illustrates your problem.

"Jeffrey Bradshaw" <Je************ **@Dictaphone.c omNOSPAM> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
Is there any way to make a copy of a word.range object? I have a range in a document and I need to monkey around with it but I don't want to change the original in the document. I've tried Duplicate() and assigning it to a new
variable. But if I change the stuff in the new variable, it changes the
original also.

So what I need is a new copy of the variable - not pointing to the same
thing.

TIA - Jeffrey

Nov 20 '05 #2

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

Similar topics

10
4839
by: Bob | last post by:
Here's what I have: void miniVector<T>::insertOrder(miniVector<T>& v,const T& item) { int i, j; T target; vSize += 1; T newVector; newVector=new T;
2
3079
by: Ruslan Shlain | last post by:
Hello everyone. I have a question that I tried to find an answer over the weekend but did not succeeded. I have a Word template with a couple of "tags" ( <<My Tag>>) that I need to replace with data from the DB. Please point me in the right direction on how to approach this. Code samples, links or articles. Anything would work. Thank you very much in advance.
0
2160
by: jijo kuruvila | last post by:
I am having one grid..i want to export that grid to word..after doing only two fields r coming ie serial no: and total..product name, quantity and unitcost r not coming into the word...those three r from databasee...How can i bring those three to the word... the code looks like this... object fileName = "C:\\Inetpub\\wwwroot\\eBilling\\jijo.doc"; object readOnly = false;
6
5196
by: Yuri Vanzine | last post by:
In asp we can run VBSCRIPT client-side which allows for 'easy' :?) ms office COM object instantiation. How do I access a Word object in ASP.NET on the client side? I would like to do spell checking from a web-based wysiwyg editor and I am limited to using ms word from the client, server-side word automation is out of the question for several important reasons (http://support.microsoft.com/default.aspx?...
5
12870
by: STeve | last post by:
Hey guys, I currently have a 100 page word document filled with various "articles". These articles are delimited by the Style of the text (IE. Heading 1 for the various titles) These articles will then be converted into HTML and saved. I want to write a parser through vb.net that uses the word object model and was wondering how this could be achieved? The problem i am running into is that i can not test whether the selected text is...
2
2181
by: Al_P via DotNetMonster.com | last post by:
I have: Win2K Office2000 Working in VB.Net (2003) My .Net project has a reference to Word 9.0 Instantiating things in a simple and straightforward manner: Dim word as Word.Application Dim doc As Word.Document Dim range As Word.Range
2
3901
by: Alan T | last post by:
I have two bookmarks, eg. beginMark and endMark I need to get the text between these 2 bookmarks, how do I do that? eg. <beginMark> Hello Word! This is Saturday.
1
4102
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS. The Web Services are explained as follows: IMPORT WEB SERVICE:
0
3202
by: deboe | last post by:
I am trying to pull in some data from a database (Access) and merge the data to a Word document (basically mail merge). I got the data to fill in the bookmarks in the document but only the first selection from the checklistbox is being pulled in. Also I need the information thats pulled in to be on a separate page in the same document. Hope that makes sense. Anyway here is my code. Here is my code: (VB.Net) Dim wdApp As...
0
8997
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
9568
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
9389
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
9335
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
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6801
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4709
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
3320
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
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.