Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Set m_AppExcel = New Excel.Application
m_AppExcel.Caption = "MyExcelViewer" m_AppExcel.IgnoreRemoteRequests = True After running my application containing the three statements above, Excel starts to exhibit very bizarre behavior when launched from the windows shell. When double clicking on an Excel document, Excel will launch, however once the application spins up, the document doesn't open! I've seen this behavior on both of my development machines. (Which so far covers 100% of the machines on which the code has run, so this seems pretty consistent.) On one of these, I was able to restore Excel functionality by hacking the registry and changing the shell open command to add a /dde parameter: "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" /e /dde. I mention this for its diagnostic value not to suggest that this should be used as a fix for the problem. Without resorting to the hack, the problem can be corrected with the following code modification: Set m_AppExcel = New Excel.Application m_AppExcel.Caption = "MyExcelViewer" m_AppExcel.IgnoreRemoteRequests = False If I change the third statement to assign False, run my program, and then exit my program, proper Excel shell functionality is restored. What's going on here? Here's the bottom line. We need to leverage Excel in order to diaply documents for our own application, but we need to do so in a way which will not disturb other Excel sessions which the user might have launched previous to our application, or which the user might launch subsequent tou our application. Is this possible? I'm having a lot of trouble keeping chnages which I make to my own Excel server, from impacting the user's Excel environment in general. Thanks for any help which you can provide. - Joe Geretz - |
#2
![]() |
|||
|
|||
![]()
Hi Joseph,
Without resorting to the hack, the problem can be corrected with the following code modification: Set m_AppExcel = New Excel.Application m_AppExcel.Caption = "MyExcelViewer" m_AppExcel.IgnoreRemoteRequests = False If I change the third statement to assign False, run my program, and then exit my program, proper Excel shell functionality is restored. What's going on here? The IgnoreRemoteRequests setting is retained by Excel after your application finishes - unless you set it back. In the Excel UI, it's on the Tools Options General tab. The general approach to your issue is to take a snapshot of the Excel settings you're likely to change, make the changes, do your stuff, then set them all back to how they were before you started. As Excel updates the registry entries when it closes, the only issue that remains is if someone changes some settings in a different instance of Excel while yours is running. The choices that get saved will depend on which one gets closed last. Regards Stephen Bullen Microsoft MVP - Excel www.oaltd.co.uk |
#3
![]() |
|||
|
|||
![]()
Thanks Stephen, your explanation is right on the money.
Here's how I'm solving this for now, which also addresses the issue of regression caused by a user making configuration changes, after my application has taken a snapshot of the configuration settings: CloseWindow m_hWndExcel, SRSWinClose.Kill Instead of closing Excel politely, I'm just killing the @#%# thing via WinAPI. This prevents any of my changes from getting saved to the Registry. Note to Microsoft: I think your Office products are terrific, and I'm impressed by the way these products can be used programmatically as automation servers as well as interactively as user applications. I suggest that it would be a valuable feature to be able to isolate an automation server so as not to impact the user's interactive environment. Perhaps a property such as Application.Isolate = True would do the trick. Thanks! - Joe Geretz - "Stephen Bullen" wrote in message ... Hi Joseph, Without resorting to the hack, the problem can be corrected with the following code modification: Set m_AppExcel = New Excel.Application m_AppExcel.Caption = "MyExcelViewer" m_AppExcel.IgnoreRemoteRequests = False If I change the third statement to assign False, run my program, and then exit my program, proper Excel shell functionality is restored. What's going on here? The IgnoreRemoteRequests setting is retained by Excel after your application finishes - unless you set it back. In the Excel UI, it's on the Tools Options General tab. The general approach to your issue is to take a snapshot of the Excel settings you're likely to change, make the changes, do your stuff, then set them all back to how they were before you started. As Excel updates the registry entries when it closes, the only issue that remains is if someone changes some settings in a different instance of Excel while yours is running. The choices that get saved will depend on which one gets closed last. Regards Stephen Bullen Microsoft MVP - Excel www.oaltd.co.uk |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I isolate my Excel server (automation) from other Excel instances? | Excel Discussion (Misc queries) | |||
Excel Automation SelectionChange event | Excel Discussion (Misc queries) | |||
Excel aficionado wants to learn Access | Excel Discussion (Misc queries) | |||
Excel aficionado wants to learn Access | Excel Discussion (Misc queries) | |||
Excel user desires to learn ABC of Access | Excel Discussion (Misc queries) |