Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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
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
Paste non-adjacent cell content from Excel to open Word document Jimbob Excel Programming 3 September 7th 08 12:57 PM
Copy Paste from Excel to specified word document raphiel2063 Excel Programming 2 September 12th 07 09:46 AM
How do I paste a Word document into an Excel cell callawayx18 Excel Discussion (Misc queries) 0 January 10th 07 10:46 PM
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 Steven Excel Programming 1 October 17th 05 08:56 AM


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