Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Embedded word object | Excel Programming | |||
Printing an embedded Word Object | Excel Programming | |||
Copy text with formatting from an Excel cell into an embedded Word object? | Excel Programming | |||
Extracting text from embedded Word Object | Excel Programming | |||
Reference to an Embedded Word Object | Excel Programming |