View Single Post
 
Old 03-23-2018, 10:09 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Guessed View Post
Is Document_Close run before the document closes or does it run after?
Assuming the Document_Close macro is in the 'ThisDocument' code module of the document or its template, it runs before the document closes - indeed, it runs before the save prompt (if applicable). If it's not where its supposed to be, it won't run at all. We can probably discount that, however, since the OP has already told us he's confirmed the correct implementation via a Message Box.

In my testing, the code works correctly. The question arises therefore as to how the OP is establishing that the variable hasn't been deleted from the document. The mere fact that the result in a DOCVARIABLE field referencing the deleted variable might remain unchanged, for example, isn't evidence; refreshing that field would soon delete its result (but not the field itself).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote