Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2013, 04:18 PM
chamdan chamdan is offline Transfering data fields from Word to Excel (2007) Windows 7 32bit Transfering data fields from Word to Excel (2007) Office 2007
Novice
Transfering data fields from Word to Excel (2007)
 
Join Date: Nov 2013
Posts: 13
chamdan is on a distinguished road
Default Transfering data fields from Word to Excel (2007)

Enclosed is a word document, which I nee to transfer all integrated fields that are actually bookmarks into a row in an Excel workbook/Worksheet. Each of the fields in sequence from top to the last one in the document have to be transferred into a column but same row using a macro that will be triggered once the last field is inputted.



Of course using VBA.

Never did it before but wishes some would help me achieve it.

Thanks in advance!

Chuck
Attached Files
File Type: docx TASK AUTHORIZATION.docx (18.7 KB, 10 views)
Reply With Quote
  #2  
Old 11-10-2013, 02:27 PM
macropod's Avatar
macropod macropod is offline Transfering data fields from Word to Excel (2007) Windows 7 32bit Transfering data fields from Word to Excel (2007) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Chuck,

I note that your document uses a combination of formfields and table cells, some of which contain bookmarks. The data extraction would be far easier if you used formfields for all of the fields that require data extraction. As it stands, it is unlikely that any of the data would be enclosed within the relevant bookmarks, which are themselves prone to accidental deletion.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-10-2013, 08:19 PM
fumei fumei is offline Transfering data fields from Word to Excel (2007) Windows 7 64bit Transfering data fields from Word to Excel (2007) Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

That and
Quote:
Each of the fields in sequence from top to the last one in the document
is a little tricky, as bookmarks are listed alphabetically, which means if you really DO want a directionality (top to bottom) you have to explicitly name them.

However, macropod has a very good point. It would be very easy to put in content that would NOT be in the intended bookmark, and yes it is easy to delete them accidentally. Formfields are fairly robust data containers.
Reply With Quote
  #4  
Old 11-10-2013, 09:09 PM
chamdan chamdan is offline Transfering data fields from Word to Excel (2007) Windows 7 32bit Transfering data fields from Word to Excel (2007) Office 2007
Novice
Transfering data fields from Word to Excel (2007)
 
Join Date: Nov 2013
Posts: 13
chamdan is on a distinguished road
Default

Thanks for replying and proposing a better solution but even with form field I would be scratching my head to resolve it as I am novice in VBA and would certainly change all the fields to form field to suit what you could offer me as a soultion by giving me a macro that will do the required task.

Thanks again in advance for your help.

Chuck
Reply With Quote
  #5  
Old 11-10-2013, 09:30 PM
macropod's Avatar
macropod macropod is offline Transfering data fields from Word to Excel (2007) Windows 7 32bit Transfering data fields from Word to Excel (2007) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Chuck,

For some code to transfer form content from Word to Excel, see:
http://www.vbaexpress.com/forum/show...el-spreadsheet
Note that, although the primary macro there is for exporting content control data, my last post in that thread shows how to modify the code to work with formfields instead. The other important difference is that the code there is intended to be added to an Excel workbook and run on demand, rather than when a particular formfield is updated.

The problem with adding the code to a Word document (or its template) and triggering its execution from Word is that you then need to have extra checks to make sure all the required fields have been completed; otherwise, simply triggering the macro could lead to empty or partially-complete records in Excel. Even with that controlled you could still end up with duplicate records in Excel. Plus, even without the above considerations, the code to do this from Word is considerably more complicated, due to the need to check things like whether the destination workbook is already in use.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 11-11-2013, 12:55 AM
fumei fumei is offline Transfering data fields from Word to Excel (2007) Windows 7 64bit Transfering data fields from Word to Excel (2007) Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Paul may not agree with me - although his last post seems to have a similar thought - but GENERALLY it is better to pull things from Word (that is, the code is run from Excel) into Excel, than it is to push things (that is the code is run from Word) into Excel.
Reply With Quote
  #7  
Old 11-11-2013, 08:19 AM
chamdan chamdan is offline Transfering data fields from Word to Excel (2007) Windows 7 32bit Transfering data fields from Word to Excel (2007) Office 2007
Novice
Transfering data fields from Word to Excel (2007)
 
Join Date: Nov 2013
Posts: 13
chamdan is on a distinguished road
Default

Thanks Paul!

I will certainly have a look at the link you sent me and will get back to you and should it work propoerly as wanted I will consider it as solved and will update mt thread.

Cheers,

Chuck
Reply With Quote
  #8  
Old 11-11-2013, 08:57 AM
chamdan chamdan is offline Transfering data fields from Word to Excel (2007) Windows 7 32bit Transfering data fields from Word to Excel (2007) Office 2007
Novice
Transfering data fields from Word to Excel (2007)
 
Join Date: Nov 2013
Posts: 13
chamdan is on a distinguished road
Thumbs up Solved - Transfering data fields from Word to Excel (2007)

Thanks Paul!

The link you sent me works perfectly.

Cheers!

Chuck
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfering data fields from Word to Excel (2007) [Excel 2007] Building Power Point Slides from data in an Excel Table bremen22 Excel Programming 1 08-07-2013 11:01 AM
Transfering data fields from Word to Excel (2007) Open Word w Excel & fill Word textboxes w info from Excel fields runtime error 4248 Joe Patrick Word VBA 2 01-30-2012 07:23 AM
Transfering data fields from Word to Excel (2007) Excel 2007 and data in dd:hh:mm:ss format Sammael Excel 6 11-05-2011 06:52 AM
Transfering data fields from Word to Excel (2007) Excel 2007 data question Paul-NYS Excel 3 09-26-2011 10:49 PM
How do I set up the fields in mail merge word 07 from my data base mbcrabber Mail Merge 4 06-06-2010 01:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft