如果没有 Table 则执行其他操作
If there is no Table then do else
我想找到一些 text
如果此文本在 table 中然后将 table 转换为文本否则什么都不做
但是当没有 Table
时,它给出 Error
Selection.Find.ClearFormatting
With Selection.Find
.Text = " - ^$^$^$^$ ^$ - ^$^$^$^$^$^$"
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
Selection.Tables(1).Select ' This is Error position
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= _
True
Else
End If
我希望它 do
它在 loop
添加条件,如果 Selection.Tables.Count > 0 到您的代码
Selection.Find.ClearFormatting
With Selection.Find
.Text = " - ^$^$^$^$ ^$ - ^$^$^$^$^$^$"
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
If Selection.Tables.Count > 0 Then
Selection.Tables(1).Select ' This is Error position
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:=True
End If
End If
此致。
@nathan_sav谢谢
以下是 loop
中的工作代码
do
Selection.Find.ClearFormatting
With Selection.Find
.Text = " - ^$^$^$^$ ^$ - ^$^$^$^$^$^$"
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
if selection.tables.count>0 then
Selection.Tables(1).Select
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= _
True
else
end if
Else
exit do
End If
loop
我想找到一些 text
如果此文本在 table 中然后将 table 转换为文本否则什么都不做
但是当没有 Table
时,它给出 Error
Selection.Find.ClearFormatting
With Selection.Find
.Text = " - ^$^$^$^$ ^$ - ^$^$^$^$^$^$"
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
Selection.Tables(1).Select ' This is Error position
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= _
True
Else
End If
我希望它 do
它在 loop
添加条件,如果 Selection.Tables.Count > 0 到您的代码
Selection.Find.ClearFormatting
With Selection.Find
.Text = " - ^$^$^$^$ ^$ - ^$^$^$^$^$^$"
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
If Selection.Tables.Count > 0 Then
Selection.Tables(1).Select ' This is Error position
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:=True
End If
End If
此致。
@nathan_sav谢谢
以下是 loop
do
Selection.Find.ClearFormatting
With Selection.Find
.Text = " - ^$^$^$^$ ^$ - ^$^$^$^$^$^$"
.Forward = True
.Wrap = wdFindStop
.Format = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
if selection.tables.count>0 then
Selection.Tables(1).Select
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= _
True
else
end if
Else
exit do
End If
loop