想在foxtable的按钮Click事件中加入如下VBA代码,需要怎样改动才能运行?Sub demon()
Dim p As Paragraph, str1 As String, str2 As String
For Each p In ActiveDocument.Paragraphs
str1 = Left(p.Range, 5)
str2 = Left(p.Range, 4)
If str1 = "【选择题】" Then
A = p.Range.Start
End If
If str2 = "【解析】" Then
B = p.Range.End
Else
GoTo 100
End If
ActiveDocument.Range(A + 6, B).Copy
Documents.Add
Selection.Paste
Selection.TypeBackspace
ActiveDocument.SaveAs2 "D:\练习\" & "x" & Left(ActiveDocument.Paragraphs(1), 1) & ".docx"
ActiveDocument.SaveAs2 "D:\练习\" & "x" & Left(ActiveDocument.Paragraphs(1), 1), 10
ActiveDocument.Close 0
100
Next
End Sub
[此贴子已经被作者于2021/1/22 9:59:29编辑过]