ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open word then find replace text (https://www.excelbanter.com/excel-programming/341761-open-word-then-find-replace-text.html)

Shawn G.

Open word then find replace text
 
I need to open a word Document then find certain text and replace it from
excel.
example:
Open WordDocTest.doc
Find text "<project#"
Replace text with "Test234"

I can open the document but cannot get it to search.
Any ideas

Thank You!


Ed

Open word then find replace text
 
You might be better off setting an object to the Word application, then
setting an object to the document opened. Then you can use the Word
application Find object on the doc object. Set your Excel cell text to a
variable, and use that variable in the Replace. Make sure you set a
reference to the Word library.

Ed

"Shawn G." wrote in message
...
I need to open a word Document then find certain text and replace it from
excel.
example:
Open WordDocTest.doc
Find text "<project#"
Replace text with "Test234"

I can open the document but cannot get it to search.
Any ideas

Thank You!




Steve Yandl

Open word then find replace text
 
Shawn,

Here is an excellent example of what you want.
http://word.mvps.org/FAQs/InterDev/C...WordFromXL.htm

Steve Yandl


"Shawn G." wrote in message
...
I need to open a word Document then find certain text and replace it from
excel.
example:
Open WordDocTest.doc
Find text "<project#"
Replace text with "Test234"

I can open the document but cannot get it to search.
Any ideas

Thank You!




Shawn G.

Open word then find replace text
 
I have the word Doc set as an object, and I can get it open. The problem is
finding the text. I cannot figure out how to get the .FIND to work.
Any ideas?

Thanks,

"Ed" wrote:

You might be better off setting an object to the Word application, then
setting an object to the document opened. Then you can use the Word
application Find object on the doc object. Set your Excel cell text to a
variable, and use that variable in the Replace. Make sure you set a
reference to the Word library.

Ed

"Shawn G." wrote in message
...
I need to open a word Document then find certain text and replace it from
excel.
example:
Open WordDocTest.doc
Find text "<project#"
Replace text with "Test234"

I can open the document but cannot get it to search.
Any ideas

Thank You!






All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com