通过Word表中的宏添加单元格 [英] Add a cell through a macro in a Word table
本文介绍了通过Word表中的宏添加单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在宏中使用什么表达式在Word 2013表格中添加单元格,将单元格向下移动?操作系统:Win10。谢谢。
What expression do I use in a macro to add a cell in a Word 2013 table, shifting cells down? OS: Win10. Thanks.
推荐答案
如果你想插入Row,这段代码可以帮到你。
If you want to insert Row, this code will help you.
Private Sub btn_InsertRow_Click()
Dim rowIdx As Integer: rowIdx = 2
Tables(1).Rows(rowIdx).Select
If Selection.Information(wdWithInTable) = True Then
Selection.InsertRowsBelow ' -- insert one row below the current row
Selection.InsertRowsAbove ' -- insert one row above the current row
End If
End Sub
插入行时应选择/激活多个单元格。否则,必须出现运行时错误。
因此,在上面的代码中,存在"Tables(1).Rows(rowIdx).Select"。
  ;  
 
More than one cell should be selected/activated when inserting row. Otherwise, run-time error must appear.
So, in the above code, there exists "Tables(1).Rows(rowIdx).Select".
这篇关于通过Word表中的宏添加单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文