word2007 vba 问题

word vba的代码,设置边框的,在2003里面能够正常使用,如下:
With Selection.Cells
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
,在word2007中出现错误,错误提示为: 集合所要求的成员不存在,发生错误的地点就在
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone这两行,有大神能帮忙解答一下吗?应该如何修改?

.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
调试下就好了,提示成员不存在可以检查下对象成员。

上面来看的话,貌似你这个代码不用写这么长就好 ,其实有个属性是边框集合的,查询下帮助看看对象属性 一下搞定。追问

整个过程前面是这样的:
Dim ta As Table
Set ta = Tables(3)
ta.Cell(ta.Rows.Count, 1).Select
Selection.InsertRowsBelow 1
Set ta = Tables(3)
ta.Cell(Row, 1).Select
+边框设置,

这样写对象成员有问题吗?

温馨提示:答案为网友推荐,仅供参考
相似回答