J
Jack Sons
Hi all,
I tried to construct code to convert all tables in a document to text. See
the code below.
It does not work.
What is wrong and why? What should the code be?
Your help will be appreciated.
Jack Sons
The Netherlands
---------------------------------------------------------------------------------------------------------------------
Sub ConvertTablesToText()
Dim oShp As Table
Dim i As Integer
For Each oShp In ActiveDocument.Tables
If oShp.Type = msoTable Then oShp.Selection.Rows.ConvertToText
Separator:=wdSeparateByTabs, NestedTables:= True
Next oShp
For i = ActiveDocument.Tables.Count To 1 Step -1
With ActiveDocument.Tables(i)
.Borders.Enable = False
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
.Delete
End With
Next
End Sub
I tried to construct code to convert all tables in a document to text. See
the code below.
It does not work.
What is wrong and why? What should the code be?
Your help will be appreciated.
Jack Sons
The Netherlands
---------------------------------------------------------------------------------------------------------------------
Sub ConvertTablesToText()
Dim oShp As Table
Dim i As Integer
For Each oShp In ActiveDocument.Tables
If oShp.Type = msoTable Then oShp.Selection.Rows.ConvertToText
Separator:=wdSeparateByTabs, NestedTables:= True
Next oShp
For i = ActiveDocument.Tables.Count To 1 Step -1
With ActiveDocument.Tables(i)
.Borders.Enable = False
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
.Delete
End With
Next
End Sub