2,464
社区成员
发帖
与我相关
我的任务
分享
set xlsapp = nothing
on error resume next
Set xlsApp = GetObject(, "Excel.Application")
on error goto 0
if xlsapp is nothing then
msgbox "没有找到已经打开的Excel实例!"
else
Set wb = xlsApp.ActiveWorkbook
msgbox wb.name
end if
xlsapp = null
on error resume next
Set xlsApp = GetObject(, "Excel.Application")
on error goto 0
if isnull(xlsapp) then
Set xlsapp = createobject("excel.application")
xlsapp.visible = true
xlsapp.workbooks.add
end if
Set wb = xlsApp.ActiveWorkbook
msgbox wb.name