We help IT Professionals succeed at work.
Get Started

Can I execute file operations after Word closes?

Last Modified: 2020-01-28
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.

Watch Question
IT Consultancy
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE