0
我需要一个MS Word的VBA代码,选择多个表(我选择)并输入一个基于文本框对象的字符串。我已经写了一个代码来做到这一点,但是如果我选择大量的表,它会变得重复。Word vba多表选择
Private Sub Claim_Change()
Dim j As Table
Set j = ActiveDocument.Tables(2)
Dim k As Table
Set k = ActiveDocument.Tables(3)
'Input claim
j.Select
Selection.Delete
With j
.Cell(1, 1).Range.InsertAfter "Claim #: " & Claim
.Cell(1, 2).Range.Text = Format(Date, "MMMM DD, YYYY ")
.Columns.AutoFit
End With
k.Select
Selection.Delete
With k
.Cell(1, 1).Range.InsertAfter "Claim #: " & Claim
.Cell(1, 2).Range.Text = Format(Date, "MMMM DD, YYYY ")
.Columns.AutoFit
End With
Claim.Select
End Sub
有没有更简单的方法来把这段代码放在一起?