ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying from word and pasting into excel (https://www.excelbanter.com/excel-programming/338120-copying-word-pasting-into-excel.html)

nims[_4_]

copying from word and pasting into excel
 
I'm trying to create code for excel that will allow me to open
series of word documents, copy certain rows from tables in thos
docs, and paste them into the excel worksheet

I know how to open word from excel, but my knowledge ends there...

Can someone please help me, by explaining how to open a word doc, cop
a table/row, and paste it into excel

Thank you


michelxld[_26_]

copying from word and pasting into excel
 

Hello

I hope this macro helps you


Sub importValuesFromWordTables()
'test with Excel2002
'Activate Microsoft Word xx.x Object Library
'
Dim WordApp As Word.Application
Dim WordDoc As Word.Document

Set WordApp = CreateObject("word.application") 'open Word session
WordApp.Visible = False 'Word not visisble during operation
Set WordDoc = WordApp.Documents.Open("C:\myDoc.doc") 'open Word doc

'copy third row of the first Word table
WordDoc.Tables(1).Rows(3).Range.Copy

'paste in Excel
Range("A1").PasteSpecial xlPasteValues

WordDoc.Close 'close Word doc
WordApp.Quit 'close Word session
End Sub


regards ,
michel


--
michelxld
------------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367
View this thread: http://www.excelforum.com/showthread...hreadid=398449



All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com