Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-26-2012, 05:33 AM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default macro+word 2003 version support

Cheers to all ,



Seraching google to get to this,

need help here i dont knw if it is possible as i dnt knw programming that much

its between word and excel file

finding
text1 from word and then go to excel (2003) and where it is mentioned text1, copy the related value and paste in word again,
then look for text2.....and so on

so to make simple

macro should ask what to find first,
search that in word file (options YES or NO to look next value)
then
go to excel and look in cell A1....A2..A100(say text.xls in c:\)
and find the related value
copy from there
and paste it in word (for the corresponding find what value it found and selected in word)
FIND next
and
repeat the process till CANCEL TO STOP
---------------------

Looking forward

N.V
Reply With Quote
  #2  
Old 03-26-2012, 09:00 PM
macropod's Avatar
macropod macropod is offline macro+word 2003 version support Windows 7 64bit macro+word 2003 version support Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Nancy,

Perhaps you could explain what you're trying to achieve (ie outcome, not method) as there may be better ways to do it (eg mailmerge, OLE).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-27-2012, 12:46 AM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

Hey Paul,

I need to change some values or text in word, and for that I use excel sheet. I generate values in excel in order to copy them in word one after the another.
Instead of every time find a value or text in word first then for the particular text search in excel and copy the corresponding value from there back to word file, I am looking for a shorter version.

Thanks for help,

NV
Reply With Quote
  #4  
Old 03-27-2012, 03:39 PM
macropod's Avatar
macropod macropod is offline macro+word 2003 version support Windows 7 64bit macro+word 2003 version support Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Nancy,

I already understood the bit about needing to change the document content, based on the workbook content, but there are different ways of doing this. A macro is only one possible way. The fact you seem to be doing a lot of this suggests that mailmerge or OLE (linking) might be a better solution.

For example, if you are trying to produce multiple documents at a time, mailmerge may be the way to go. Alternatively, if it's essentially the same content in a single document being updated on a regular basis, OLE (linking) may be the way to go.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-27-2012, 11:58 PM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

Kindly Suggest what is best and easy method for me as I am not that aware about the same,

requirement is the same same

say we searched for a word Text 1 (which will be macro asked) now it will search this is excel and what is corresponding value of text 1 is say xxx00, it copies from there, and ask to paste in word doc where Text 1 is there.

next it goes to find next, value say in sequence of Text 2 Text 3.....etc and repeat .... till CANCEL from user.

You know better then me, the solution, so suggest on that line only....

there is nothing related to mailmerge etc.

Thanks a lot Paul,

Reply With Quote
  #6  
Old 03-27-2012, 11:59 PM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

I have office 2003, as more info
Reply With Quote
  #7  
Old 03-28-2012, 01:48 AM
macropod's Avatar
macropod macropod is offline macro+word 2003 version support Windows 7 64bit macro+word 2003 version support Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Nancy,

As I have said, there are different ways of updating your document.
Quote:
A macro is only one possible way. The fact you seem to be doing a lot of this suggests that mailmerge or OLE (linking) might be a better solution.
Until you tell me more about how you are using the document, I am reluctant to give you a solution that might be done more efficiently another way.
Quote:
For example, if you are trying to produce multiple documents at a time, mailmerge may be the way to go. Alternatively, if it's essentially the same content in a single document being updated on a regular basis, OLE (linking) may be the way to go.
The macro in this link https://www.msofficeforums.com/vba/1...o-problem.html shows how one might go about updating a Word document from an Excel file. It would need some changes before it could be used for your purposes but, as I've already said, there may be a better way. Some 80% of the code in that link is needed just to manage Excel.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 03-28-2012, 07:50 AM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default hi

I tried downloading that excel and doc but that are in xlsx and docx format so cant open that and see, but the issues could be solved like this, but here I have doubt once the link is not there , wont the replace changes again into original?

I am attaching both files for your reference, where test 1....test 3 etc are need to be worked upon,

Here to make it use ABLE for any find and replace text, macro should ask the text first, and while coping and pasting again in word from excel, it must ask if that is required word, else find next and replace with corresponding value,
Attached Files
File Type: xls Book1.xls (13.5 KB, 7 views)
File Type: doc test.doc (19.5 KB, 7 views)
Reply With Quote
  #9  
Old 03-28-2012, 01:58 PM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

I some how saw these attchments, it will replace where ever that name comes without first confirming the user, we need here in such a manner that after cpy it ask yes to replace that word in doc if no go to next word...etc, and STOP to no to proceed..

I think u got the idea what m i talking abt
thanks (also that prog code was really grt to help him out )
alas if i knew anything abt the prgming must have tried to do smthng with that pgm...

NV
Reply With Quote
  #10  
Old 03-29-2012, 04:25 AM
macropod's Avatar
macropod macropod is offline macro+word 2003 version support Windows 7 64bit macro+word 2003 version support Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Nancy,

Do the data in your Excel workbook always update the same locations in the Word document? For example, does the value in B1 always replace 'test 1' in the Word document? If so, you don't need a macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 03-29-2012, 06:32 AM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

yes it is like that, but we need to see that while replacing macro ask if that is the only value we need to replace , else look for the next word "test 1" and replace it with a confirmation.

thanks,

NV
Reply With Quote
  #12  
Old 03-29-2012, 06:40 AM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

IN excel it search should move in both direction like first if it is found text 1 then go from that location then it goes to find say text 25, it copy from that position and if text 12 comes it moves up to search first and then find and copy..... also the data in excel could be limited to 100 or 150.

(this is just for reference as from the link you provided for some other macro support)
Reply With Quote
  #13  
Old 03-29-2012, 08:13 AM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

By the time you suggest, I have tested https://www.msofficeforums.com/vba/1...o-problem.html

is amazing to say, it works as per his needs

in my requirement it fits except

1. We dont need hyperlink but the value to be pasted instead of word file searched word,
2. Macro condition to ask whether to replace this word in word doc with excel value or not, if no move and search very next word text 1, in word file and replace ...till end,
3. Then it search for text 2(user input), in excel and again same as step 2,
4. and keep repeating steps till user cancel for no more.

This is my observation only, rest as you suggest.
--------


Nv
Reply With Quote
  #14  
Old 03-29-2012, 03:04 PM
macropod's Avatar
macropod macropod is offline macro+word 2003 version support Windows 7 64bit macro+word 2003 version support Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Do the data in your Excel workbook always update the same locations in the Word document? For example, does the value in B1 always replace 'test 1' in the Word document? If so, you don't need a macro.
Quote:
Originally Posted by nancy v View Post
yes it is like that, but we need to see that while replacing macro ask if that is the only value we need to replace , else look for the next word "test 1" and replace it with a confirmation.
In that case, you probably don't need a Find/replace macro. What would probably suit your needs better is to link the data. To set up the link, all you need to do is to copy a given cell in Excel, switch to Word, then use Edit|Paste Special, click on the 'paste link' option and choose whichever of the paste formats you prefer. From then on, whenever you update the value in Excel, it will update in Word.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 03-29-2012, 03:42 PM
nancy v nancy v is offline macro+word 2003 version support Windows XP macro+word 2003 version support Office 2003
Novice
macro+word 2003 version support
 
Join Date: Mar 2012
Location: Brazil
Posts: 21
nancy v is on a distinguished road
Default

yes it could be done as you said but once the excel r word doc file is renamed it looks for link,

I am looking for excel as an help only file not a permanent connected file,
The main changes are to be done in word doc file only
there is no need for excel as far as word doc is concerned, I am using it to make work easy as once i collect the values at one place that is excel, rest could be automated through as you say macro,

The macro or program which you suggested to the link you provided, looks fine
except

1. Instead of hyperlink we need relevant cell value to be replaced in word,
2. Condition to replace the found word(in word doc) with cell value YES, and No for to look next similar word and replace it,

Hope this helps
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro+word 2003 version support Can Word 2007 support graphs? burnsie Drawing and Graphics 1 07-08-2011 07:08 AM
Word 2003 macro to Word 2007 to 2010 to... maruapo Word VBA 0 06-04-2010 03:43 PM
does office word 2007 support html signature! jimijani1982 Word 2 05-04-2010 04:37 AM
[Word 2003] Macro's and a UserForm xanuex Word VBA 0 10-19-2009 05:42 AM
Problem with AutoClose macro and Word 2003 cholo Word VBA 0 07-08-2009 05:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft