Re: Using ActiveDocument when mutliple documents open

Thousands of people rely on ActiveDocument every day; if there is a problem it needs identifying. You are the only person, to my knowledge, seeing such a problem at the moment - perhaps it's SP2 or some other recent update causing it.

You seem to be coming across this often enough for it to be a problem so could you please tell us under precisely what conditions you see the problem and what actions (both inside and outside Word) precede its occurrence. Please include, at a minimum, the version of Word 2007 and updates applied, the operating system and version, other applications (at least all VBA-enabled ones) running at the time, the state of the "Windows in Taskbar" option, and any other options you think relevant.


"Webboex" <Webboex@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:3D86C14E-2504-4E26-AAD0-5E73221AB721@xxxxxxxxxxxxxxxx
Even the simple macro:

Sub TestActiveDocument()
MsgBox ActiveDocument.Name
End Sub

cannot reliably identify the active document every time. I can only think it
has something to do with how Word 2007 handles its document windows. I have
never had a problem with it in earlier versions of Word.

"Tony Jollans" wrote:

I would expect Active Document to be as you say, and have never heard of
problems with it, but, and I am guessing a little, if you have "Windows in
Taskbar" set, there may be actions (Show Desktop, perhaps) that effectively
re-arrange the Windows so that what you thought was active is no longer
deemed so by the system.


"Webboex" <Webboex@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> In Word 2007, if there are multiple documents open, ActiveDocument does
> not
> always refer to the last document I viewed or typed in and instead
> sometimes
> reverts back to the last document on which I used the procedure.
> As I can replicate this problem with a one line macro
> MsgBox ActiveDocument.Name
> the problem is not related to the complexity of the code I am trying to
> run.
> Is there any other way of referring to the document I last worked on or
> viewed?