Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Pushing or Poking Word form data to an Excel spreadsheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnF - 25 May 2006 18:53 GMT
We have a client who has created a Microsoft Word 2003 form template to
capture risk investment information from managers in our organization.

Managers will fill this document in and return it to this client.

The client would then like to "push or poke" the form data from the word
template into an Excel 2003 spreadsheet.

The excel spreadsheet will have a pre-defined format and specific form
fields or bookmarks from the word document will populate the excel
spreadsheet.

My question - what is the best way to do this?

The word form template will have some 60 fields. Not all of them will be
pushed into the excel spreadsheet but there must be some kind of mapping or
linkage between specfic fields / bookmarks and cell location references in
the excel spreadsheet.

Thanks again for any insight on this one.
Jezebel - 25 May 2006 22:40 GMT
1. Get a reference to Excel and open the workbook --

Dim pxlApp as Excel.Application
Dim pxlBook as Excel.Workbook

Set pxlApp = Excel.Application
Set pxlBook = pxlApp.Wordbooks.Open(FileName:=....)

2. Iterate the formfields in the document and insert the values into Excel.
Dim pFormField as Word.Formfield

For each pFormField in ActiveDocument.FormFields
   pxlBook.Sheets([datasheet name]).Cells(Row,Column) = pFormField.Result
Next

How you set the row and column obviously depends on how you set up the
workbook. If each form becomes a new row in the workbook, name the target
columns using the same names as used for the Word formfields. Check
worksheet UsedRange property to get the last used row, then add one.

> We have a client who has created a Microsoft Word 2003 form template to
> capture risk investment information from managers in our organization.
[quoted text clipped - 17 lines]
>
> Thanks again for any insight on this one.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.