View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
onedaywhen onedaywhen is offline
external usenet poster
 
Posts: 459
Default Problem with ADO with Parameter Object

"Tod" wrote in message ...

I have vbscripts that open a workbook, run it's Sub Main
procedure, then close the workbook. Each workbook is using
ADO to get data from a database. The basic code for the
script looks like this:

Set xl = CreateObject("Excel.Application")
Set CurrentBook = xl.Workbooks.Open
("C:\MyPath\MyWorkbook.xls")
xl.Run "Main"
CurrentBook.Save
CurrentBook.Close
xl.Quit
Set CurrentBook = Nothing
Set xl = Nothing

This works fine. However, two of the workbooks stay open
in memory after the Sub Main has run.


Are you allowing enough time for

xl.Run "Main"

to complete before executing

CurrentBook.Save
CurrentBook.Close

?

--