Option Explicit
Dim xlapp As Variant
Dim xlBook As Variant
Dim xlSheet As Variant
Dim i As Integer
Private Sub Command1_Click()
i = i + 1
xlSheet.Cells(1, i + 1) = Text1.Text
xlSheet.Cells(1, 1) = Time$
End Sub
Private Sub Form_Load()
Set xlapp = CreateObject("excel.application")
xlapp.Visible = True
Set xlBook = xlapp.Workbooks.Add
Set xlSheet = xlBook.worksheets(1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
xlapp.Quit '关闭EXCEL
Set xlapp = Nothing '释放EXCEL对象
End Sub