Wilkommen, Bienvenu, Welcome... Sziasztok!

Welcome to The Lotus Position, an intermittent collection of extempore navel gazings, ponderings, whinges, whines, pontifications and diatribes.

Everything is based on a Sample of One: these are my views, my experiences... caveat lector... read the Disclaimer

The Budapest Office - Castro Bisztro, Madach ter

The Budapest Office - Castro Bisztro, Madach ter
Ponder, Scribble, Ponder (Photo Erdotahi Aron)

Guest Nutter/Kindred Soul: Bill Bailey


Tuesday, 22 July 2008

Windows Cannot Find... Resolved!


Recently, whenever I double-clicked a Microsoft Word (Word 2002/Word XP) document, Word would start but I would also get an error message from Windows that ""Windows cannot find..." and then the full path to the file I just double-clicked . Naturally I was able to open the file perfectly well once Word was running.

I don't think the general cause or symptoms are application or Windows version specific, so the hint should be good across the board... Vista, XP...

So what gives in this particular case? It could have been a shortcut whose target no longer exists, a missing registry entry perhaps, or if it had been an Excel document (Excel ~20020 ) it might have happened if Excel had been set to ignore other applications - but it wasn't, though the Excel thing a clue (it's a DDE - Dynamic Data Exchange - thing in the end... (or Automation (as they call it now, I think)).

In this case it was all to do with "AutoExec" - which was taking too long to run (lots of Programmatic Stuff). Microsoft has a knowledgebase article for Word2000 that says if AutoExec includes a "Wait" this error can arise, but it's really not the waiting that's important it seems, it's how long the AutoExec takes to complete before Word can respond to the Windows instruction to open the file.

So, the message "Windows cannot find..." is, not unusually, completely misleading: Windows can, has found the file - but the application requested to open the document hasn't responded in time.

And that's it really... to work around the issue I simply took all the long winded stuff out of AutoExec, put it in "delayedAutoExec" and put in this line in the leaner, slimmer, more responsive AutoExec. The delay is short but just long enough for Word to OK the document open request.

Application.OnTime when:=Now + TimeValue("00:00:05"), Name:="delayedAutoExec"

I expect it's also going to cure the bizarre error that was "Application.Activate" failing (during the AutoExec code) because there wasn't, as far as VBA was concerned, any Application to activate!

et voilà, the file is no longer not found.

Pie/Cake Stuff.