|
用vb6.0新建一个excel,并绘制一个矩形,如下:
程序代码如下:
- Private Sub Command3_Click()
- Dim xlapp As New Excel.Application '定义excel对象
- Dim xlbook As Excel.Workbook '定义excel工作薄
- Dim xlsheet As Excel.Worksheet '定义excel工作表
- Set xlapp = CreateObject("Excel.Application") '新建excel对象
- Set xlbook = xlapp.Workbooks.Add '新建excel工作薄
- xlapp.Visible = True '设置excel对象可见
- Set xlsheet = xlbook.Worksheets("sheet1")
- <font style="background-color: yellow;" color="#000000">ActiveSheet.Shapes.AddShape(msoShapeRectangle, 0, 50, 747.1, 170).Select</font>
- '(矩形,距离左侧宽度,距离顶部高度13.5*n,长度6.375*10.6*n,高度13.5*n+2*Diata(h))
- 'kk = Range("h25").Width / Columns(1).ColumnWidth 查看每个单元格宽度命令
- Selection.ShapeRange.Fill.Visible = msoFalse
- With Selection.ShapeRange.Line
- .Visible = msoTrue
- .Weight = 2.25 '线条粗细
- End With
- With Selection.ShapeRange.Line
- .Visible = msoTrue
- .ForeColor.RGB = RGB(255, 0, 0) '线框颜色
- .Transparency = 0
- End With
- End Sub
复制代码 运行后单击按钮,上面黄色这一样提示错误,错误类型为:指定的值超出了范围,请高手告诉我是什么原因?
|
|