简体   繁体   中英

VBA copy word table to excel with bullet points

I have incorporated this code, which I got from an older post, in my script. The code goes through each table in a word document and inserts it in the excel file. The tables are put in the same sheet and one below the other. The problem is that the cells in the word tables contain bullet points and numbering which when moved to excel are completely lost. Is there any easy modification that I can do in order for the bullet points to transfer over? Thank you.

For tableStart = tableNo To tableTot With.tables(tableStart)

        For iRow = 1 To .Rows.Count
            For iCol = 1 To .Columns.Count
                Cells(resultRow, iCol) = WorksheetFunction.Clean(.cell(iRow, iCol).Range.Text)
               
            Next iCol
            resultRow = resultRow + 1
        Next iRow
    End With
    resultRow = resultRow + 1
Next tableStart

You could use code like:

ActiveDocument.Range.ListFormat.ConvertNumbersToText

to convert all auto-numbering etc. to actual text. Alternatively, you could limit it to specific tables, as in:

ActiveDocument.Tables(1).Range.ListFormat.ConvertNumbersToText

Discard the changes when you're done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM