PDA

View Full Version : Table Help



psctornado
02-17-2011, 09:22 PM
Hi,

I'm a newbie when it comes to VBA, excel, word however I was recently given the responsibility of working on an existing mail merge document. The data is stored in a excel source and merges the the data from excel to word. My question is I have a a couple of different tables, (1) with the names of individuals in one column and in the other column I have a dollar amt associated with them. There are several cases where the total amt of rows are not needed. How is it possible to not "show" the extra rows. Additionally, how can I "generate" or create additional rows in a table as I input data in my excel data source. Sorry for the long winded question, however I have searched a great deal and nothing seems to be working. Any help would be greatly appreciated!!

Joe:hi:

Tinbendr
02-18-2011, 02:07 AM
Welcome to VBA Express!

Sorry, I don't have a specific answer, but here are a couple of resources for you to read through.

Word.MVPS Mail merge (http://word.mvps.org/FAQs/MailMerge/index.htm)
Types of Mail Merge (http://addbalance.com/usersguide/mailmerge.htm)

You can attach a file with a before and after so we can get a idea of what's going on.

David

psctornado
02-18-2011, 06:34 AM
Hi David,

Thanks for the reply. Attached is a made up sample of what I am trying to do. I have a simple spreadsheet that changes based on the data I input (ie sometimes 4 rows, sometimes 5, 6 etc. What I would like to do is to create a table in word that inserts more rows as I enter in the data in my excel sheet. I wasn't sure if its a macro I need to create and or some standard code that is out there. Conversely, if the data is say only 3 rows in length a table would only be created with 3 rows rather than 4, 5, 6 etc. I checked out the links you provided, they suggest to just create a table manually in word, however I would think a table could be made and generated via a macro through excel and when it is run a table would be generated in word.

Thanks again for any help!
Joe

psctornado
02-18-2011, 10:39 AM
I've been thinking about this and to better explain. I currently have mail merge fields in my document retrieving currently data in my .xls source. I have read that loops can be done, however merge field data cannot be in the field if the loop is to delete the existing line. Is there any code that can still delete the row even if mergefield data exists?

Thanks again!:hi:

Dave
02-18-2011, 01:27 PM
Why not just scrap the whole mail merge and add/remove the correct size tables and/or correct amount of table rows as needed. This can all be done from XL with some VBA. HTH. Dave

psctornado
02-18-2011, 01:31 PM
Hey Dave,

I'm all for scraping the mail merge, however I'm a bit confused with how to go about this based on your prior response. Would you be able to help me a bit regarding the method you mentioned?

Thanks
Joe:yes

Dave
02-18-2011, 03:00 PM
There's some XL to Word table stuff here. The only difficulty likely would be locating the table in the .doc Have a look and see if it's useful. Dave
http://www.vbaexpress.com/forum/showthread.php?t=17784

macropod
02-25-2011, 04:49 AM
Hi Joe,

You can use Word's Catalogue/Directory Mailmerge facility for this (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
http://lounge.windowssecrets.com/index.php?showtopic=731107 (wlmailhtml:{C7EF91AA-B2C7-45B8-98CA-046449FCFFF9}mid://00000008/!x-usc:http://lounge.windowssecrets.com/index.php?showtopic=731107)
or
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip (wlmailhtml:{C7EF91AA-B2C7-45B8-98CA-046449FCFFF9}mid://00000008/!x-usc:http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip)
Do read the tutorial before trying to use the mailmerge document included with it.