Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is Excel running? If not, then open it.

Status
Not open for further replies.

Carrion

Technical User
Jul 26, 2002
27
US
I need code to check and see if excel is running. If so then activate it. If not then open a new spreadsheet and activate it.

thanks
 
A keyword search, or browse the helpfiles, for createobject and getobject would probably prove worthwhile.

Roy-Vidar
 
I have searched for quite a while, to no avail. Does anyone know a good thread that they could recomend for me?
 
Something like this?

[tt]dim xl as object
on error resume next
' get current instance of excel
set xl=getobject(,"excel.application")
if err.number<>0 then
' excel not open, then create an instance
err.clear
set xl=createobject("excel.application")
if err.number<>0 then
' excel not installed?
err.clear
exit sub
end if
end if
on error goto <your error handler>
'...[/tt]

- typed not tested

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top