Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to send data from word to excel


Hi,

I am trying to create a summary document of data held in a table at the
start of many word documents.

When a person modifies one of the many word documents they are asked to
fill in 4 cells of the table at the top of that document, recording the
changes.

I tried to record a macro to copy the cells I wanted and paste them
into a summary document in excel, so the user would simply have to
press a button to submit the information they added, to the summary
document.

However, i was unable to select cells of a table in the "record macro"
mode. I then inserted an excel spreadsheet into word for users to log
their changes, so I could reference the cells, but I could not edit the
spreadsheet in "record macro" mode either!

I have also tried creating a linked object but could not make that work
either!

I dont mind whether the summary document is in excel or word format (i
just thought excel would be easier to write to) or whether the table in
the word documents is a table or spreadsheet, could you please suggest
a way of copying the added information in each of the many tables when
a user edits the documents to a summary document??

Thank you!

Tory


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default macro to send data from word to excel

Tory

Here's a sub that might get you started. It assumes that the first table in
your word doc is the table you want to use. It also assumes that the last
row of the table is the row you want to log into the excel workbook. It
uses automation to open the excel workbook so you have to set a reference
(Tools - References) to the Excel object library.

Sub LogTable()

Dim xlApp As Excel.Application
Dim xlWb As Excel.Workbook
Dim xlSh As Excel.Worksheet
Dim xlRng As Excel.Range
Dim Tbl As Table
Dim i As Long

'Use the first table in the document
Set Tbl = ActiveDocument.Tables(1)
Set xlApp = New Excel.Application

'open the log workbook
Set xlWb = xlApp.Workbooks.Open("C:\Dick\WordLog.xls")
Set xlSh = xlWb.Sheets("Sheet1")

'Find the next open line on the sheet
Set xlRng = xlSh.Range("A65536").End(xlUp).Offset(1, 0)

'Loop through the columns and transfer the text
'to excel
For i = 1 To Tbl.Columns.Count
xlRng.Offset(0, i - 1).Value = _
Tbl.Cell(Tbl.Rows.Count, i).Range.Text

Next i

xlWb.Save
xlWb.Close
xlApp.Quit

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"tory04" wrote in message
...

Hi,

I am trying to create a summary document of data held in a table at the
start of many word documents.

When a person modifies one of the many word documents they are asked to
fill in 4 cells of the table at the top of that document, recording the
changes.

I tried to record a macro to copy the cells I wanted and paste them
into a summary document in excel, so the user would simply have to
press a button to submit the information they added, to the summary
document.

However, i was unable to select cells of a table in the "record macro"
mode. I then inserted an excel spreadsheet into word for users to log
their changes, so I could reference the cells, but I could not edit the
spreadsheet in "record macro" mode either!

I have also tried creating a linked object but could not make that work
either!

I dont mind whether the summary document is in excel or word format (i
just thought excel would be easier to write to) or whether the table in
the word documents is a table or spreadsheet, could you please suggest
a way of copying the added information in each of the many tables when
a user edits the documents to a summary document??

Thank you!

Tory


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
using excel data for a word macro Ann Excel Discussion (Misc queries) 1 May 29th 08 10:04 PM
Send multi data (Graph/Cell data) to Word doc as 1 item (no cells) Tom-LE Excel Discussion (Misc queries) 0 August 30th 06 10:10 PM
My send to in excel/word does not offer send as attachment Mstink Excel Discussion (Misc queries) 11 March 16th 06 02:49 PM
i need to create an invioce in EXCEL and then send it into a WORD. cassie Excel Discussion (Misc queries) 1 March 12th 05 07:49 PM
Send array data from Excel macor to Word Doc using DDEPoke Vijay Chaudhari Excel Programming 0 November 7th 03 07:12 PM


All times are GMT +1. The time now is 09:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"