请问VB操作word问题
我有一个word,里面有一些合并单元格,那么就有一些单元格是不存在的,请问如何判断哪些单元格是不存在的单元格?
[解决办法]
http://download.csdn.net/detail/veron_04/1627134
[解决办法]
'生成表格
Set usTable = ActiveDocument.Tables.Add(Range:=Word.Selection.Range, NumRows:=4, NumColumns:=9)
With usTable
.Range.ParagraphFormat.KeepWithNext = True '保持与下段同页,即表格中不分页
.Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
.Borders(wdBorderLeft).LineWidth = wdLineWidth050pt
.Borders(wdBorderRight).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineWidth = wdLineWidth050pt
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderTop).LineWidth = wdLineWidth050pt
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderBottom).LineWidth = wdLineWidth050pt
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
.Borders(wdBorderHorizontal).LineWidth = wdLineWidth050pt
.Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
.Borders(wdBorderVertical).LineWidth = wdLineWidth050pt
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
.Rows.Alignment = wdAlignRowCenter
.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter '水平居中
.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter '垂直居中
End With
'开始填写数据
For usI = 1 To 4
For usJ = 1 To 9
usTable.Cell(usI, usJ).Range.Text = usBZData(usI, usJ) '在当前单元格中填写内容
' usTable.Cell(usI, usJ).Select '选择单元格
' Word.Selection.TypeText Text:=usBZData(usI, usJ) '在当前单元格中填写内容
Next usJ
Next usI
[解决办法]
不太合理的程序
用错误处理
取cell属性,正常取到的就是存在的,取不到的就是被合并的