vb调用EXCEL问题
最近写了一个程序,是vb调用EXCEL在EXCEL上生成所要的报表.1 在VB中 工程->引用->Microsoft Excel 11.0 Object library
Dim bl As Excel.Application
Dim wbook As Variant
Set bl = New Excel.Application
bl.Visible = True
bl.SheetsInNewWorkbook = 1
Set wbook = bl.Workbooks.Add
Myexcel = True
.............................
With ActiveSheet.Cells(1, 2)
.Font.Name = "宋体"
.Font.Size = 20
.Font.Color = RGB(0, 0, 0)
.Font.Underline = xlUnderlineStyleDouble
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
End With
.......
ActiveSheet.Cells(1, 2).Value = "采购配件总表"
结果符合要求,能正确调用EXCEL,通过程序也可生成所需要的正确报表,
2 存在的问题是:
如果不关闭程序重新打开,要想再做一张报表就出现了错误.可以再调出新的EXCEL页面,但要对其操作仍然是对第一次调出的EXCEL 的操作.
还请各位大虾赐教!不胜感激!
[此贴子已经被作者于2005-9-15 15:11:04编辑过]