|
发表于 2011-12-2 11:32:00
|
显示全部楼层
Private Sub Command1_Click()
Dim Excel As Object
Dim ExcelSheet As Object
Dim ExcelWorkbook As Object
'创建Excel应用程序实例
On Error Resume Next
Set Excel = GetObject(, "Excel.Application")
Set ExcelSheet = Excel.ActiveSheet
Excel.Visible = True
With ExcelSheet
If Len(.cells(1, 1)) = 0 Then
.cells(1, 1) = "块名称"
.cells(1, 2) = "阀名称"
.cells(1, 3) = "数量"
End If
N = .cells(65536, 1).End(-4162).Row + 1
.cells(N, 1) = "你的数据"
End With
End Sub
不建议你Excel申明为后期绑定,正确的应用前期绑定。这也就是你找不到空行原因。 |
|