ConvertToText Method Example

This example creates a table and then converts it to text by using tabs as separator characters.

Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Range:=Selection.Range, _
    NumRows:=3, NumColumns:=3)
i = 1
For Each aCell In myTable.Range.Cells
    aCell.Range.InsertAfter "Cell " & i
    i = i + 1
Next aCell
MsgBox "Click OK to convert table to text."
Set myRange = myTable.ConvertToText(Separator:=wdSeparateByTabs)

This example converts the table that contains the selection to text, with spaces between the columns.

If Selection.Information(wdWithInTable) = True Then 
    Selection.Tables(1).ConvertToText Separator:=" "
Else
    MsgBox "The insertion point is not in a table."
End If