![]() |
problem editing Word document with VBA from Excel
Sorry - posted too soon
I have just discovered that this is a known bug - Microsoft Knowledge Base Article - 292744 - and you can get round it by using late binding Malone "Malone" wrote in message ... I am trying to find and replace words in a Word document from Excel using VBA. The following code gives me an error message - method 'execute' of object 'find' failed I can get similar code to work using VBA from within the Word Application but not when I use it from Excel. Can someone tell me what elementary error I am making? Using XP with Excel 2002 SP-2. Thanks Sub editword() Dim objWD As Word.Application Dim wrdDoc As Word.Document Set objWD = CreateObject("Word.Application") Set wrdDoc = objWD.Documents.Open("C:\Documents and Settings\admin\My Documents\worddoc.doc") objWD.Visible = True objWD.Selection.Find.Execute FindText:="image", ReplaceWith:="picture" objWD.Quit Set wrdDoc = Nothing Set objWD = Nothing End Sub |
All times are GMT +1. The time now is 12:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com