Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tee
 
Posts: n/a
Default Copy from WORD to EXCEL using a macro.....

I have the following macro that opens a word document from excel..

************************************************** ***

'Sub OpenWord()

'
' OpenWord Macro
' Macro recorded 28/02/2006 by rivers
'


Set appWd = CreateObject("Word.Application")
appWd.Visible = True

ChDir "S:\PROJECTS\Paypoint-zone"

appWd.Documents.Open FileName:="S:\PROJECTS\Paypoint-zone\Invoice.rtf"

'End Sub


************************************************** **

This opens word and the document "invoice".

I would like to know if anyone knows how I can write a macro to copy the
text in the word document into my excel spreadsheet that is open???????

(I usually do this by highlighting the text on the word doc and doing an
edit/paste special.)

Then close the word document and return to the excel spreadsheet....

HHHHHEEEEEEEELLLLLLLLPPPPPPPPP.................... .............





  #2   Report Post  
Posted to microsoft.public.excel.misc
Steve Yandl
 
Posts: n/a
Default Copy from WORD to EXCEL using a macro.....

How is the text organized in the Word document? You can return any or all
of the text without using copy/paste or even having the Word document
visible. You generally have to do some text manipulation because you will
import things like end of paragraph marks that will appear as odd characters
in Excel but it is generally simple enoug to handle. Below is an example
that will bring all the text in the body of the document into cell A1.

Sub GrabFromWord()
Set objWd = CreateObject("Word.Application")
Set objDoc = objWd.Documents.Open("C:\Test\TestB.doc")
Set myRange = objDoc.Range(0, 0)
myRange.WholeStory
strStory = myRange.Text
Cells(1, 1).Value = strStory
objDoc.Close
objWd.Quit
Set objWd = Nothing
End Sub


Steve


"Tee" wrote in message
...
I have the following macro that opens a word document from excel..

************************************************** ***

'Sub OpenWord()

'
' OpenWord Macro
' Macro recorded 28/02/2006 by rivers
'


Set appWd = CreateObject("Word.Application")
appWd.Visible = True

ChDir "S:\PROJECTS\Paypoint-zone"

appWd.Documents.Open FileName:="S:\PROJECTS\Paypoint-zone\Invoice.rtf"

'End Sub


************************************************** **

This opens word and the document "invoice".

I would like to know if anyone knows how I can write a macro to copy the
text in the word document into my excel spreadsheet that is open???????

(I usually do this by highlighting the text on the word doc and doing an
edit/paste special.)

Then close the word document and return to the excel spreadsheet....

HHHHHEEEEEEEELLLLLLLLPPPPPPPPP.................... .............







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
Macro to copy a word doc into an excel doc Tee Excel Discussion (Misc queries) 0 February 22nd 06 12:01 PM
Copy a whole Word doc into Excel sheet & keep it all visible? Jackstri Excel Discussion (Misc queries) 1 February 16th 06 01:56 PM
Linking table in Excel to word travis Links and Linking in Excel 1 November 19th 05 02:30 PM
excel 4.0 macro removal tool Sachin Shah Excel Discussion (Misc queries) 0 August 25th 05 04:17 AM
copy addresses from word to excel msventura Excel Worksheet Functions 2 December 9th 04 10:44 PM


All times are GMT +1. The time now is 07:22 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"