Results 1 to 2 of 2

Thread: Copying Tables from Word to Excel
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default Copying Tables from Word to Excel

    I have multiple Word documents each which contain multiple tables. I need to extract a certain one of these tables and input it into Word. I have a working VBA code that can accomplish this, however, it has a few limitations. The tables contain a few unique characters (|,,, etc) along with some symbols that refer to an installed font. Both Word and Excel have this font, however, when I copy the tables the font does not come over.

    Currently I copy the tables by looping through each cell and saving that to an array in VBA then writing that array to cells in Excel interface. I have noticed if I open the Word file manually and Ctrl-C and Ctrl-V the table into Excel the characters will be retained.

    Looking for suggestions on how to migrate over those unique characters with either method (using VBA to go cell by cell, or using VBA to save table to clipboard then paste in Excel). Either way, it needs to be automated using VBA because I have thousands of these files to go through.

  2. #2
    Board Regular pbornemeier's Avatar
    Join Date
    May 2005
    Virginia Beach, VA USA
    Post Thanks / Like
    0 Post(s)
    1 Thread(s)

    Default Re: Copying Tables from Word to Excel

    Cell-by-Cell and character by character you can use AscW to get the wide ascii value for the characters in Word tables and ChrW to put them in Excel.

    Posting your existing code may allow a better answer

    ChrW Demo:
    Sub Partial_ChrW_List()
        Dim lRow As Long
        For lRow = 1 To 5000  'There are more above this
            Cells(lRow, 1).Value = lRow
            Cells(lRow, 2).Value = ChrW(lRow)
    End Sub

    - Use CODE tags to keep your code formatted. See: BB Tags
    - How to attach Screenshots
    - Try searching for your answer first, see how
    - Test and validate results for all code on a copy of your worksheet!! How do you use the code you just found?
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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