标题: 关于GetObject( , class ) [打印本页] 作者: guoning1973 时间: 2005-12-27 15:09 标题: 关于GetObject( , class ) 大家能给解释一下GetObject( , class )这个函数吗?帮助不是很理解作者: ilovejolly 时间: 2005-12-27 16:05
理解OLE2 object吗?可以先去看看这个相关的资料,再来看函数就好理解了作者: guoning1973 时间: 2005-12-27 16:18
好的作者: guoning1973 时间: 2005-12-27 17:30
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
'Initially Recorded: 2005-8-2 9:36:33
'Script Name: gn1
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("test.xls")
Set worksheet = book.Worksheets("test")
end sub
当我运行这段程序时,弹出提示信息(见附件),什么原因.错误出在"Set excel = GetObject(,"Excel.application")"作者: ilovejolly 时间: 2005-12-27 17:44
你首先要打开一个excel,你还是没明白帮助里的意思