Word does not name its tables, so manually assign a bookmark to the table if you have to use VBA to convert a specific table to text. The comparable statement uses the ConvertToTextmethod of the Tables collection.Ī(1).ConvertToText Separator:=wdSeparateByTabs The VBA code to convert a Word table object is similar to that of Excel. You can convert all the tables on the active sheet to a range using this procedure: Sub ConvertTablesToRange()Īdding a nested For-Next loop converts all the tables in the active workbook: Sub ConvertTablesToRange()Įnd Sub Convert a Word Table to Text Using VBA Use the name of the table shown on Table Design tab (Properties group):ĪctiveSheet.ListObjects(“MyTable”).Unlist Reference the table by name to convert one table on the active sheet with more than one table. Reference the table by number to convert the first or only table on the active sheet: The statement uses the Unlist method of the ListObjects collection. The most simple approach is to add one statement to your procedure. The Record Macro command does not record converting a table to a normal range, so you have to type it yourself. Convert an Excel Table to a Normal Range Using VBA The character you choose becomes the delimiter. The choice Other gives you a similar result. Choose this option to save the text as a CSV file (Comma-Separated Values). If you choose Paragraphs, the text forms a single list, starting with the left column.ģc.The choice Commas resembles Tabs, except commas are inserted instead of tabs. This option also works for saving a text file with Tab as the delimiter.ģb. If you choose Tabs, the table layout is preserved with tab stops between cells, as shown. Choose how to separate the text between table cells.ģa. From the Layout tab, choose Convert to Text (Data group).ģ. Position the cursor anywhere in the table. Like Excel, a table cell in Word is the intersection of a row and column, as shown here.ġ. From the Layout tab, choose Convert to Range (Tools group).ģ. This is usually done by clicking a cell.Ģ. The steps to convert a Table object to text are almost the same for Word and Excel.ġ. Convert an Excel Table to a Normal Range Using VBA.Convert an Excel Table to a Normal Range.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |