Fog Creek Software
Discussion Board




Excel automation with locked workstation?

I have seen similar questions posted elsewhere, but nobody has ever got an answer!  I posted this to microsoft.public.excel.programming and microsoft.public.office.developer.automation, but no answers there either.

I wrote a small app (VB.NET) that copies some data into excel and pivots it.  It works fine.

But if your workstation is locked while the application is running, Excel gives this error dialog - "Not enough system resources to display completely".  Then my application stops.  Surely I should do some better error handling, but what causes Excel to give this error?  Automation doesn't work with a locked workstation?

Again, the application works fine as long as the workstation is open - I can even work on lots of other tasks while it runs, no resource problems at all. But when the workstation is locked, this error message pops up.

I am using VB.NET 2003, Excel XP SP3, Windows XP Workstation SP1.

Scott Stonehouse
Friday, June 11, 2004

I'll give you an educated guess.  It probably has something to do with the fact that a locked machine is running with a different desktop.  This desktop doesn't allow programs to display anything on it because that wouldn't be very secure, would it?  Excel is trying to do something it shouldn't and is getting denied.  Does your app create any new windows while it's running?  I'd stop that if so.

APIs involved in this stuff are OpenInputDesktop, CreateDesktop, SwitchDesktop, etc.

This is just a guess but might give you something to go on.

Doug
Friday, June 11, 2004

is excel visible when the error occurs?

jon
Friday, June 11, 2004


If you can look into doing this "headless", that would probably work for you.  This will bypass any display issues.

"Headless" is the term used (mostly in the Linux/Unix world) to describe when a machine is used without a monitor.

KC
Friday, June 11, 2004

Thanks, you guys are fast!

I set the Excel.Application.Visible to False and that solved it. 

I'll have to remember that the Microsoft newsgroups are not the place to get answers!

Still not entirely clear why it works that way, I guess it has something to do with the different desktops.  If the application is visible, it's looking for the window?  But if it's not visible, it doesn't look for the window? 

Scott Stonehouse
Friday, June 11, 2004

"Still not entirely clear why it works that way, I guess it has something to do with the different desktops.  If the application is visible, it's looking for the window?  But if it's not visible, it doesn't look for the window? "

I don't think it has anything to do with a program looking for a window.  Its related to Excel trying to create a window on a desktop display it doesn't have permission to.

  When the screen is locked, some user owns it (lets say Administrator, I don't know the details).  Your user running the program (say 'Flo') woudl be able to do this fine usually, because she's logged in and the display is running as Flo.  But when the screen is locked, a program running as Flo tries to display on the desktop owned by Administrator, and the error ensues.

  When you turn off visibility Excel doesn't try to write to the desktop, it just runs without displaying itself.  Thus it doesn't get the error about writing to the Administrators desktop, and all runs well.

Andrew Hurst
Friday, June 11, 2004

Sounds good to me.  Thanks.

Scott Stonehouse
Friday, June 11, 2004

Microsoft GUI is CUI

Captive user interface.  The default is that it expects a user to click "ok"  Being a Unix fan, this behavior is unaceptable to me.

Mike
Friday, June 11, 2004

Why's it unacceptable to have OK as the default?

Because Unix users like to be contrary on principle?

Stephen Jones
Saturday, June 12, 2004

I believe Mike is referring to the fact that one can't walk away from a substantial amount of Windows software, leaving it to do something, without it throwing up a nag box.  Windows installs have to be the worst.  Why they can't get all their questions out of the way at the beginning I'll never understand.  Especially now that they take substantial time to finish.  I do realize they have unattended installations options if you want to spend the time setting that up.

Doug
Saturday, June 12, 2004

"Why's it unacceptable to have OK as the default?

Because Unix users like to be contrary on principle?"

No not at all.  What Doug said.  I don't want to have to click a dialog off the screen.  Just do what I told you and shut the hell up is the order of the day in Unix.

Mike
Monday, June 14, 2004

Exactly the same problem for me...

Hi Guys (and girls)!
My program behaves in the same manner as described earlier. When I run my program (Agilent VEE) everything works fine but when I leave it over the night (long time tests) it breaks down (not enough system resources). That seems to occur when I log on again. So thank you all very much for this info, I thought it was the PC or my program that was faulty, thanx!

Sometimes Internet is really great!

Blue skies

/Johannes

JOhannes G
Thursday, June 17, 2004

I kept getting this one when I went for a smoke ... finally figured what the problem was thanks to all of you. The issue I have is that I open some worksheets from a batchfile one after the other and use macros to close each one when the processing is done. I have used Excel.Application.Visible=False in Sub Workbook_Open() but the issue has not been resolved. Could someone please let me know how I can start Excel in the invisible mode.

I open them with
"C:\program files\OfficeXP\Office10\EXCEL.EXE" C:\ExcelSheet1.xls

Aditya
Tuesday, July 06, 2004

Misrosoft has released a hotfix which fixes this. Haven't tried it yet, but hope it does what it says.

http://support.microsoft.com/?id=829348

Aditya
Monday, July 12, 2004

*  Recent Topics

*  Fog Creek Home