Copy text from embedded Word object?
In a worksheet is an embedded Word object. When I click a button, I
want the object's text to copy to cell A1. Can anyone please help me with this? I'm using Excel 2003. Thanks, Chuck |
Copy text from embedded Word object?
Sub Macro1()
' For Each obj In ActiveSheet.OLEObjects If InStr(obj.progID, "Word.Document") 0 Then 'open word document obj.Activate Set WordDoc = obj.Object.Application.ActiveDocument Set WordApp = obj.Application pos = WordDoc.words.first.Start pos2 = WordDoc.words.last.End Set WordRange = WordDoc.Range(Start:=pos, End:=pos2) WordText = WordRange.Text ThisWorkbook.ActiveSheet.Range("A1") = WordText Exit For End If Next obj End Sub "c mateland" wrote: In a worksheet is an embedded Word object. When I click a button, I want the object's text to copy to cell A1. Can anyone please help me with this? I'm using Excel 2003. Thanks, Chuck |
All times are GMT +1. The time now is 09:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com