PDA

View Full Version : Checking For Commands From Central Server



MJK
12-06-2016, 07:56 AM
I have created an Excel Add-In used by my entire team. I keep the most recent version on the Network drive and whenever someone re-opens Excel, the add-in checks if there is a new version and updates itself automatically.
What I'd like to do is be able to send commands to the add-ins individually to execute. For instance, if I have an important update to push, rather than waiting for each user to re-open Excel, I'd like to be able to save the command on the Network drive in a text file (i.e. "USER: ALL; COMMAND: UPDATE") and each user's add-in would automatically pick-up that command and process it within a reasonable time frame.
My question is what's the best method for accomplishing this? I can think of two solutions off the top of my head, neither of which I like.
Potential Solution #1 - In 'Worksheet_Calculate' or some similar place, have it check for new commands and process any it finds. However that seems like overkill and would potentially be checking far too often.
Potential Solution #2 - Use an infinite chain of Application.OnTime calls so that every X seconds/minutes it's checking for new central commands and will process any it finds. However I find Application.OnTime to be funky and unreliable.
Any ideas? I feel like doing something with a Class is the way to go but I don't have much experience with those.