Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, Adrian. If you want to search the Word doc and do one sentence at a
time as you find one that needs replacing, I think you'd be better off driving this from a Word macro. The way I would do it breaks down like this: -- Open Word doc and Excel workbook. These are the only Word and Excel files open. -- Make sure Excel workbook is open to the correct worksheet. -- User selects a sentence in the Word doc to replace, and then runs the macro. The macro: -- Sets objects to both files. -- Set a bookmark at the selection. -- Searches the Excel file for the selected text. -- If found, replaces that with the desired text. Then again, if you want to run the whole Word doc all at once, maybe an Excel macro is better. I'd have it in the specific workbook that contains you find/replace list. It would go like this: -- Browse for Word doc and open. -- Iterate through the Excel list, using those cell values to drive Find/Replace in the Word doc. The first way gives you control over replacing specific sentences; the second way just runs through the entire doc. Which way sounds good to you? Ed wrote in message oups.com... Hi, I'm a newbie to VBA programming and just trying to automate some tasks for my Dad to save him some time. I have a word document and each of these sentences are in a cell in excel (sheet1, column A, Starting at cell 2 onwards). What I would like to do is create a program that will take a sentence in word search for it in the above column and replace it with the next in the next column over, That is, if a sentence is found in A3 it would replace the sentence with The text from B3. Any help or advice on how to do this would be grateful. Thaniks, Adrian |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I search for a word within a excel document | Excel Discussion (Misc queries) | |||
Functions (search within search result) reply to this please | Excel Worksheet Functions | |||
Functions (search within search result) | Excel Worksheet Functions | |||
Copy from Word to Excel, and retain indent, plus word wrap | Excel Discussion (Misc queries) | |||
search for a specific word and copy the word and the preceeding words until a comma | Excel Programming |