我在工程中增加Microsoft Office Web Components 9.0控件,在窗体中放置了Spreadsheet控件,该控件名为sp
如下代码报错
with sp
.Range(.Cells(1,16),.Cells(1,16)).Select
.ActiveCell.Formula="=SUM(RC[-12]:RC[-1])"
end with在.ActiveCell处报告如下错误:
实时错误 '-536608723 (e004002d)'
对象 'Formula'的方法 'Range' 失败设置表格边框的代码也有如下的问题
with sp
.Range(.Cells(1,1),.Cells(1,16)).Select
.Selection.Borders(5).LineStyle=-4142
end with在.Selection处报告:
实时错误 '5'
无效的过程调用或参数以上代码在Excel 2000的宏中均运行正常,为什么到vb6中就出错,请高人指点
如下代码报错
with sp
.Range(.Cells(1,16),.Cells(1,16)).Select
.ActiveCell.Formula="=SUM(RC[-12]:RC[-1])"
end with在.ActiveCell处报告如下错误:
实时错误 '-536608723 (e004002d)'
对象 'Formula'的方法 'Range' 失败设置表格边框的代码也有如下的问题
with sp
.Range(.Cells(1,1),.Cells(1,16)).Select
.Selection.Borders(5).LineStyle=-4142
end with在.Selection处报告:
实时错误 '5'
无效的过程调用或参数以上代码在Excel 2000的宏中均运行正常,为什么到vb6中就出错,请高人指点
第一个: 不要使用rc 。
第二个: LineStyle 用 0 即可。