Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy a word doc into an excel doc | Excel Discussion (Misc queries) | |||
Copy a whole Word doc into Excel sheet & keep it all visible? | Excel Discussion (Misc queries) | |||
Linking table in Excel to word | Links and Linking in Excel | |||
excel 4.0 macro removal tool | Excel Discussion (Misc queries) | |||
copy addresses from word to excel | Excel Worksheet Functions |