Word opens Excel with Shell("excel.exe filename"). How to recycle instance of Excel and avoid locking Personal.xls
Posted on 2003-03-25
Running Office XP Professional at SP-2
I have a word macro that opens an excel file by:
x = Shell("C:\Program Files\Microsoft Office\Office10\EXCEL.EXE c:\aaatmp\" & myfile$ & ".xls", 4)
The first time I run it things work fine--the excel application is started, and myfile$ opens. Naturally, my hidden personal.xls workbook also opens.
the next time I run the macro, a second version of the Excel Application opens up and gives a message "Personal.xls is locked for editing. Every time I run it, I get another application and another message.
Is there any way to get shell to recycle the existing the application?
While I'm asking questions, I don't like putting full path in Shell("c:...offic10\excel.exe"). The simpler way, Shell("excel.exe") seems to work fine, but I've never seen that documented. Do you think its safe to drop the path name from registered applications?