Hello Leith Ross,
I also had the same problem (GetObject) not working. It worked fine on Excel 2003 but when moving to a laptop with Excel 2007 it did not work, however using your empty string suggestion solved the problem. Thanks, Keith.
Hello Leith Ross,
I also had the same problem (GetObject) not working. It worked fine on Excel 2003 but when moving to a laptop with Excel 2007 it did not work, however using your empty string suggestion solved the problem. Thanks, Keith.
Hi Again,
Well, after further testing the solution did not work as I expected, so I summarise as follows:-
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.![]()
Set XlApp = GetObject("", "Excel.Application")
Finally however I got it working in 2007, the correct code to use is:
with this format, no new object is created, and instead the existing application is returned and the existing workbook is found...![]()
Set XlApp = GetObject(Class:="Excel.Application")
/k
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks