VB6为什么生成EXE文件后,调用EXECL的语句用不了显示错误
Dim ExlApp As ObjectDim ExlBook As Object
Dim ExlSheet As Object
Private Sub Command1_Click()
Set ExlApp = CreateObject("Excel.Application") '创建Excel的应用程序实例
Set ExlBook = ExlApp.Workbooks.Add '创建Excel的工作簿
Set ExlSheet = ExlBook.Worksheets(1) '创建Excel的一张表
ExlSheet.Range("A:G").Font.Size = 9 '设置A到G列的字号
ExlSheet.Range("A:G").Font.Name = "宋体" 'A到G列字体
ExlSheet.Range("A:A").RowHeight = 24 'A到A列行高
ExlSheet.Range("A1:G1").Font.Name = "黑体" '首行字体
ExlSheet.Range("A1:G1").Font.Bold = True '首行加粗
ExlSheet.Rows.HorizontalAlignment = xlVAlignCenter '设置水平居中
ExlSheet.Rows(1).RowHeight = 24 '第1行的行高=24
ExlSheet.Cells(1, 1).Value = "单 位"
ExlApp.Visible = True '显示Excel
Set ExlSheet = Nothing
Set ExlBook = Nothing
Set ExlApp = Nothing
End Sub