troubleshooting Question

Can I execute file operations after Word closes?

Avatar of Bryce Bassett
Bryce BassettFlag for United States of America asked on
VBANetworkingMicrosoft Word
16 Comments1 Solution110 ViewsLast Modified:
I've got a global template (.dotm in the user's Word\STARTUP folder) that creates a custom tab in the Word ribbon menu, with buttons for all kinds of document automation macros written in VBA.

As part of my initialization checks, I'd like to determine whether the user has the latest version of the Add-In installed, by comparing a flag file in the registry vs. one on a network resource library.  If the user does not have the latest version installed, I want to give them an opportunity to download it to their machine.  

I know how to copy the .dotm file from the network and place it in the correct folder on the user machine, but the obvious problem is that the (old version of the) global template is open as long as Word is open, so I can't immediately replace the file.  I can download the .dotm file to STARTUP with a slightly different filename, but then there are two copies.  Is there a clever workaround for this scenario?  Some kind of script that can be set to execute after Word closes, to delete the old file and rename the just-downloaded file?   That's getting outside my area of expertise, but any pointers would be appreciated.

Steve Knight
IT Consultancy

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros