Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Need text from embedded Word object

Excel 2003
WinXP
VBA References activated:
Visual Basic for Applications
Microsoft Excel 11.0 Object Library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft Word 11.0 Object Library

The following code successfully transcribes to A1 the text from an
embedded Word object, it leaves out characters such as tab and
paragraph characters. I need it to transcribe those as well so that
paragraphs, for example, actually start a new line in the cell, and
original tab spaces carry over as well.

Any way to do that?

Sub CopyText()
Application.ScreenUpdating = False
Dim oWord As Word.Document
Dim rWordText As Word.Range
Dim sText As String
Set oWord = ActiveSheet.OLEObjects("Object 1").Object
Set rWordText = oWord.Range
sText = rWordText
Range("a1").Value = sText
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Need text from embedded Word object

Correction:
I have checked the Word 10 library, not Word 11

Thanks.

On Jun 2, 1:04 am, c mateland wrote:
Excel 2003
WinXP
VBA References activated:
Visual Basic for Applications
Microsoft Excel 11.0 Object Library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft Word 11.0 Object Library

The following code successfully transcribes to A1 the text from an
embedded Word object, it leaves out characters such as tab and
paragraph characters. I need it to transcribe those as well so that
paragraphs, for example, actually start a new line in the cell, and
original tab spaces carry over as well.

Any way to do that?

Sub CopyText()
Application.ScreenUpdating = False
Dim oWord As Word.Document
Dim rWordText As Word.Range
Dim sText As String
Set oWord = ActiveSheet.OLEObjects("Object 1").Object
Set rWordText = oWord.Range
sText = rWordText
Range("a1").Value = sText
Application.ScreenUpdating = True
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Need text from embedded Word object

I reduced the code down to this, but it still will not copy paragraph
separations and tabs from the Word object. I know Excel uses ALT+Tab
for a new line, which is different from Word. And I know Excel has no
tab character. But is there a way to maybe substitute those characters
from Word with proper Excel characters?

Again, this transcribes text from an embedded Word object into A1, but
does not transcribe the needed paragraph breaks and tab spaces.

Any help on this? Thanks.

Sub CopyText()
Application.ScreenUpdating = False
Dim oWord As Word.Document
Dim rWordText As Word.Range
Set oWord = ActiveSheet.OLEObjects("Object 1").Object
Set rWordText = oWord.Range
Range("a1").Value = rWordText
Application.ScreenUpdating = True
End Sub




On Jun 2, 1:04 am, c mateland wrote:
Excel 2003
WinXP
VBA References activated:
Visual Basic for Applications
Microsoft Excel 11.0 Object Library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft Word 11.0 Object Library

The following code successfully transcribes to A1 the text from an
embedded Word object, it leaves out characters such as tab and
paragraph characters. I need it to transcribe those as well so that
paragraphs, for example, actually start a new line in the cell, and
original tab spaces carry over as well.

Any way to do that?

Sub CopyText()
Application.ScreenUpdating = False
Dim oWord As Word.Document
Dim rWordText As Word.Range
Dim sText As String
Set oWord = ActiveSheet.OLEObjects("Object 1").Object
Set rWordText = oWord.Range
sText = rWordText
Range("a1").Value = sText
Application.ScreenUpdating = True
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
Embedded word object GS80 Excel Programming 0 February 22nd 08 09:31 AM
Printing an embedded Word Object bluegrassstateworker Excel Programming 0 May 4th 07 02:58 PM
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 09:28 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"