+ Reply to Thread
Results 1 to 5 of 5

Converting ListBox items (with multiple columns) to an existing table in word

  1. #1
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Converting ListBox items (with multiple columns) to an existing table in word

    This is part of an Excel VBA automation. I have a Pre-formatted table of 5 columns having only the header row and one empty row. Need help to fill this table using a listbox items.

    The Sr No to be filled using ListItem Index
    Next three table columns will be picked from ListBox Item – having 3 Columns
    The last table column will be a calculated column

    The number of rows should get added depending on Listbox ListCount.
    Please see attached a sample word doc. I am not familiar with handling Word in VBA. Kindly help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Converting ListBox items (with multiple columns) to an existing table in word

    If you do not attach some sample 'xls' file to show what the data source (for the table in Word) looks like, then probably no one will take care of it (and the matter is not difficult at all).
    Data should not be true, protect your privacy and sensitive data ... etc. ...

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Converting ListBox items (with multiple columns) to an existing table in word

    You have already been given a lot of help with writing to and reading from listboxes, plus Word automation. What have you tried? After all, ExcelForum isn't simply a free coding service for those who don't want to make an effort. For some automation code that shows how you might populate a Word table from Excel, see: https://www.excelforum.com/word-prog...excel-vba.html. It wouldn't take much work to output listbox entries to the table instead...
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: Converting ListBox items (with multiple columns) to an existing table in word

    I indeed got good support from this forum. And I am very much thankful for that. I am working on a couple of projects with tight deadlines, hence I end up asking many questions here.

    Yes the solution was simple. I read a few articles, one of them was from Paul. Below was the simple code that was used by me.
    I had two doubts:
    1. How to identify the right table in the word doc: by testing out a sample file with few tables, and randomly creating new tables in between I figured that the Table index is just the order in which it appears in the doc.
    2. How to refer to word table cells , find existing no of rows and insert rows: I figured that from Paul's article. By the way I did that before I came back to forum to see that Paul had replied. Paul I did spend 1.5 hours reading on net to understand Word Tables.

    Thank you once again for your support.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Converting ListBox items (with multiple columns) to an existing table in word

    Quote Originally Posted by hemantparmar View Post
    I read a few articles, one of them was from Paul. Below was the simple code that was used by me.
    I had two doubts:
    1. How to identify the right table in the word doc: by testing out a sample file with few tables, and randomly creating new tables in between I figured that the Table index is just the order in which it appears in the doc.
    2. How to refer to word table cells , find existing no of rows and insert rows: I figured that from Paul's article. By the way I did that before I came back to forum to see that Paul had replied. Paul I did spend 1.5 hours reading on net to understand Word Tables.
    That's OK, but when you're asking for help, you should post the code that shows what you're trying to do and ask for help with the part you're having difficulty with instead of posting in a way that suggests you're expecting the responder to provide a total solution. In this case, it seems all you needed to do was some more research.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Listbox update multiple items in Listbox
    By ricklou in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-12-2017, 02:28 PM
  2. [SOLVED] Listbox items - Add with ListStyleOption with columns and remove duplicates
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-22-2016, 12:53 PM
  3. Looping through columns for listbox items in a user form
    By dksr84 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2016, 02:26 AM
  4. How to write selected listbox items into a table in excel using vba
    By mahendra.asapu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2016, 11:51 PM
  5. [SOLVED] VBA -How to keep existing range column headers when converting to table
    By Quinn.Farley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2016, 05:30 PM
  6. Transfer random listbox items to new listbox and then loop through selected items
    By narrowgate88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-31-2013, 05:58 PM
  7. Replies: 2
    Last Post: 12-21-2011, 02:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1