Hi All,

I might be being a bit retarded here, but I'm having a bit of a silly issue and for some reason I can't wrap my brain around it. I've built a routine that exports the contents of a table into Microsoft Excel, through the use of Javascript and ActiveX. Here's the code:

<script language = "javascript">
var iCellsStr = ""
var hCellsStr = ""
var rangeStr = "ABCDEF"
var rowCount = 1
var colCount = 1
function xcTable()
{
var eWApp = new ActiveXObject("Excel.Application")
eWApp.Visible = true
eWApp.Workbooks.Add()
xlSheet = eWApp.ActiveSheet


for (iCells = 0; iCells < t1.cells.length; iCells++)
{

iCellsStr+=(t1.cells[iCells].innerText + " ")
cellWriteStr = rangeStr.substring(rowCount-1, rowCount) +colCount
xlSheet.Range(cellWriteStr).Value = t1.cells[iCells].innerText


rowCount++
if(rowCount ==7)
{
rowCount = 1
colCount++
}
}

rowCount = 1
colCount = 1

eWApp = null;
}
</script>

What I'd like to be able to do is leave the Excel book open until the user has finished with it (they will close it at their leisure). However, if I do that, there is a process left in the process tree that doesn't get killed when the user exits Excel. If I do the closure from Javascript through the workbook object first, however (following), it does kill the process.

Instead of having:
eWApp.WorkBooks.Add()

I can have:
var eWkBookAdd = eWApp.Workbooks.Add()

This allows me to close the object with:
eWkBookAdd.Close(false)

But if my user wants to work with the data straight away I can't kill the process! I tried setting the eWApp object to null, hoping that when the user was finished with Excel, I could use the GarbageCollect() method, but this didn't work either. In fact it caused a Doctor Watson error in Excel. Is there any workaround for this or even a sensible suggestion? Or am I trying to open pandoras box?

Cheers in advance
Joe