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

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
Need text from embedded Word object c mateland[_2_] Excel Programming 2 June 3rd 08 12:10 AM
Embedded word object GS80 Excel Programming 0 February 22nd 08 09:31 AM
Copy text with formatting from an Excel cell into an embedded Word object? [email protected] Excel Programming 0 January 8th 07 05:32 PM
Extracting text from embedded Word Object Barb Reinhardt Excel Programming 1 September 25th 06 10:49 PM
Reference to an Embedded Word Object [email protected] Excel Programming 2 April 20th 06 03:05 PM


All times are GMT +1. The time now is 07:24 AM.

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"