Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
Excel document locked for editing? Kristin_Wade Excel Discussion (Misc queries) 0 August 31st 06 05:50 PM
excel document locked for editing krish Setting up and Configuration of Excel 3 November 16th 05 08:17 PM
Problem with linked Excel table in a word Document jcarlos Excel Discussion (Misc queries) 1 August 5th 05 07:41 PM
Hyperlink to word document problem JS Links and Linking in Excel 0 December 8th 04 10:54 PM


All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"