|
Set excel = GetObject(,"excel.application")
if(excel Is Nothing) then
Set excel = CreateObject("excel.application")
if(excel Is Nothing) then
MsgBox "Couldn't find Excel!"
Exit Sub
End if
End if
Set book = excel.Workbooks.Open("c:\Your Book1.xls")
Set worksheet = book.Worksheet("Sheet1")
For count=1 To 2
s_name = worksheet.Cells(1,count).value
s_pass = worksheet.Cells(2,count).value
Next
用这些代码就可以实现写数据到Excel中了.把读数据的那几句比如s_name = worksheet.Cells(1,count).value 改成 worksheet.Cells(1,count).value=" 要写的数据值" |
|