Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to open & copy paste a word document in excel using macros?
Dear Friends,
I wanted to create an excel macro which will do the following: -Ask for a path to open a word document -Copy and paste data from word (which is in table format) to excel Could you please assist me? If possible please also mail me your answers at Thanks in advance for your help!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to open & copy paste a word document in excel using macros?
Hi Amit
Try the below which copies the 1st table from the word document to excel active sheet range A1 Sub Macro2() Dim strFile As String, wrdApp As Object, wrdDoc As Object With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = False .Filters.Add "Word Documents", "*.doc", 1 .InitialFileName = "C:\" .Show strFile = .SelectedItems(1) End With Set wrdApp = CreateObject("Word.Application") wrdApp.Visible = False Set wrdDoc = wrdApp.Documents.Open(strFile, ReadOnly:=True) wrdDoc.Tables(1).Range.Copy Range("A1").PasteSpecial xlPasteValues wrdDoc.Close False Set wrdDoc = Nothing Set wrdApp = Nothing End Sub -- Jacob (MVP - Excel) "Amit Raokhande" wrote: Dear Friends, I wanted to create an excel macro which will do the following: -Ask for a path to open a word document -Copy and paste data from word (which is in table format) to excel Could you please assist me? If possible please also mail me your answers at Thanks in advance for your help!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste non-adjacent cell content from Excel to open Word document | Excel Programming | |||
Copy Paste from Excel to specified word document | Excel Programming | |||
How do I paste a Word document into an Excel cell | Excel Discussion (Misc queries) | |||
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro | Excel Programming |