I've developed VBA code in Access 2007 which starts a 'hidden' Word session, does stuff, and then quits the Word session. All works fine except under 2 scenarios - (A) If there is another 'normal' Word session running prior to the code running and (B) If a 'normal' Word session starts whilst the code is already running.
Under the (A) scenario, when the code attempts to quit Word, the dialog "Word cannot save this file because it is already open elsewhere .... Normal.dotm" is displayed, which I cannot trap. To workaround this, I've tried (i) using
which doesn't appear to work (same error), (ii) using a template other than "Normal.dotm" in the documents used by the code, which doesn't work either (same error), and (iii) considered using Word's command line switches - which I don't think can be used when issuing a
. So I'm stuck on this.
Under the (B) scenario, when launching a document whilst code is running, then this uses the 'hidden' session, rather than a new Word session, and is therefore unusable. So, I'm stuck on this too!!
I have faith that one of you can help me!!
Under the (A) scenario, when the code attempts to quit Word, the dialog "Word cannot save this file because it is already open elsewhere .... Normal.dotm" is displayed, which I cannot trap. To workaround this, I've tried (i) using
Code:
objApp.NormalTemplate.Saved = True
Code:
Set objApp = CreateObject("Word.Application")
Under the (B) scenario, when launching a document whilst code is running, then this uses the 'hidden' session, rather than a new Word session, and is therefore unusable. So, I'm stuck on this too!!
I have faith that one of you can help me!!