|
Sub Main
Dim Result As Integer
dim excel as Object
dim book as Object
dim worksheet as Object
dim s_name as String
dim s_pass as String
dim count as Integer
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
end sub
请问各位有经验人事,为什么单步调试到红色语句(Set worksheet = book.Worksheet("Sheet1"))时,提示"no such property or method"... ...难道是语法不对吗?不太明白。
[ 本帖最后由 bb64844866 于 2008-5-21 08:55 编辑 ] |
|