help...

I am using the Excel 9 object library as part of an application I've written. I use the function below to check this is a valid Excel spreadsheet. Every time I call this, Windows starts another instance of Excel.EXE, and doesn't terminate it when I'm finished. This is a major pain. Any ideas ? (NOTE - this is the only code which uses the Excel object model at present - I'm not even doing anything yet !)


Public Function IsValidExcelFile(ByVal vstrFileName As String) As Boolean

Dim objBook As Excel.Workbook

On Error GoTo handler
IsValidExcelFile = False

Set objBook = Excel.Workbooks.Open(vstrFileName)
IsValidExcelFile = True

handler:

Set objBook = Nothing

End Function