Hi Again,
Well, after further testing the solution did not work as I expected, so I summarise as follows:-
Set XlApp = GetObject(, "Excel.Application")
works in 2003, i.e. it just fetches the existing running excel object and does not open any new object (exactly the behaviour I was looking for. This however does not work in 2007 version, instead the error code 429 is returned.
Set XlApp = GetObject("", "Excel.Application")
as suggested by Leith above solves the Error 429, but the behaviour now is to open a new Excel application. Originally I though this had worked because it returned object, and i saw no new Excel Application running, however this was because it was not visible. I only detected it because the xlApp.Workbooks.Count call was returning 0 open workbooks when clearly there was a workbook open in the visible application.
Finally however I got it working in 2007, the correct code to use is:
Set XlApp = GetObject(Class:="Excel.Application")
with this format, no new object is created, and instead the existing application is returned and the existing workbook is found...
/k
Bookmarks