0

これは私がこれまでに持っているものですが、SEToCurrentRowに苦労しています

Sub InsertRow()

Dim EventDate As String
Dim oTable As Table
Dim oCell As Cell
Dim oCurrentRow As Row
Dim oNewRow As Row

If Not Selection.Information(wdWithInTable) Then
MsgBox "Can only run this within a table"
Exit Sub
End If


Set oTable = ActiveDocument.Tables(1)
Set oCurrentRow = Selection.Cells(1).RowIndex


oCurrentRow.Select
With Selection
.Collapse Direction:=wdCollapseStart
.InsertRowsAbove 1
End With
' go to inserted row and insert text

    End Sub

oCurrentRowの上に行を挿入すると、cell(1)にテキストを追加したい場所に新しく挿入された行が参照されると思います。

4

1 に答える 1

1

RowIndex は行ではなく数値を返すため、行オブジェクトの設定には使用できません。変化する

Set oCurrentRow = Selection.Cells(1).RowIndex

Set oCurrentRow = oTable.Rows(Selection.Cells(1).RowIndex)

そして、ガスで調理する必要があります。

于 2013-02-28T23:10:21.083 に答える