Public myexcel As New Excel.Application
Public mybook As New Excel.Workbook
Public mysheet As New Excel.Worksheet
'以上在模板中定义或者在窗口中定义也可以
Private Sub Command1_Click()
Set myexcel = CreateObject("Excel.Application")
'首先连接EXCEL
Set mybook = myexcel.Workbooks.Add
Set mysheet = mybook.Worksheets(1)
mysheet.Cells(1, 1) = text1.text
mysheet.Cells(1, 2) = text2.text
mysheet.Cells(1, 3) = "text3.text
Set myexcel = Nothing
End Sub
上面那个是我在百度中找出来 的。。可是不能运行,一运行就提示:子程序或函数中的属性无效。。。
帮我看看,谢谢。。。