Updating An add-in Through the Internet

Hi All!

I’ve just posted a new article to my website, with the subject as shown in the title of this post.

Short summary:

When you’re offering an add-in through your website it is sometimes useful if your users are automatically notified of updates (many software titles have such a mechanism built-in). The article shows a way to include that functionality with your add-in.

Read it here:

Updating An add-in Through the Internet

Enjoy!

Jan Karel Pieterse
JKP Application Development Services

Posted in Uncategorized

8 thoughts on “Updating An add-in Through the Internet

  1. Yeah good stuff Jan Karl,
    I do the same sort of thing across a network (using a ini file to hold the version numbers).
    I was going to ask this question over at PODA, – how do people update their code – I guess I had 2 ideas, replace with the same file name for the whole addin, or change code in the module, the latter has the issue of not always working (virus SW etc).
    Any other methods out there?

  2. Ross, I use vb script to update my custom addin. Basically, I check for the latest rev on the main server. If it has changed, I tell my code to run the vbscript which uninstalls the addin, deletes it, copies the latest version down to the users computer and installs it. I only check for updates the first time Excel is opened after the first of the month and ask for the users permission before updating.

  3. Ross, I have an addin installed on about a half-dozen users’ computers. It checks every workbook they open. If it has an associated addin in the same directory as the master addin, it checks for a newer version on the server. If there is, it copies the newer version to the user’s addin folder.

    Two problems with this (at least). What if I change the master addin code or the shared network folder? I think I need one more level of addin that handles just those two things. Fortunately the master addin has not needed much updating yet, and I’ve got few enough users that I’ve just updated the master by hand. It’s saved me lots of work though in updating the workbook-specific addin code, which gets modified on a regular basis.

    My master addin is the most code I’ve ever written. It tracks every application-level event, checks whether the workbook-associated addins have such an event and runs it if they do. It also allows me to create new workbook-associated addins on the fly, modify their menus (the menus are created by the master), turn off all or some events for the associated addins, and some other things. It took me a year to write (at home in my spare time) and I learned a lot!

    I really like my system. It’s made developing and distributing my addins much simpler. The only worry is that I’ve chained myself to some extent to this system, mainly in that my users have to have the master addin installed. I have some solutions in mind for that though.

  4. Ross,

    I have an add-in that I developed at work, for work. It’s production version is Read Only, and resides in a network folder (not copied to local add-ins folders.) The only person that has a local copy of the add-in is myself.

    Basically, I code any updates in my local copy. When it’s ready for an update, I have code that overwrites the network version. Since the network version is read only, I never have to worry about a user having it locked. I just toggle the read only state, save the file, set to read only, and re-save the current file to the local copy again. I actually wrote up the process on my site here.

    This is all good for the internal developer/maintainer, of course, but falls apart if the add-in is deployed outside of your network. I really like the idea behind Jan Karel’s code for that. :)

    Cheers,

    Ken

  5. Ken: This readonly trick might work to avoid the need to rename the loaded addin before downloading and overwriting the old copy, and thus also the need to remove the renamed old copy. It does mean you have to remember setting that option during setup .

  6. Jan Karel,

    That’s interesting… I hadn’t considered that, but I can see where you’re coming from. I’ve never tried to save over a file that I have active in my own Excel instance. With the add-in loaded as read only though, it will be entirely in memory. So in theory it’s no different from what I’m doing to my users, and should work, providing that you don’t actually try and open the file. Definitely worth a test. :)

  7. Thanks Chaps.

    I notice that basically everyone is overwriting the whole file – I think this makes sense from an application based code behind type solution (i.e. code in a xla file)

    Charles,
    Your method sounds a bit more like it’s coming form a standard exe type back ground, that’s to say uninstall, remove, reinstall, – in my method I just replace the file – if the name & path are the same it’s ok, ‘cus the reg settings will still target that file. It’s not fallen over yet, but I think your method is more robust.

    Doug,
    That sounds like a quite a complex situation, not sure if my mind could stretch to managing all that lot! It’s an interesting approach but I think I would be happier with the checking part being done by the addin itself, still your method may be very suitable for that very complex situation.

    Ken
    I have read your article before ken, when I started to look at this deployment issue – and I think it might have come of on a forum too at some point?, I like the idea but like you point out, no good for laptop users ;-)

    Good stuff thanks Jan Karl and everyone else for sharing!

  8. Hi everyone,

    Just wanted to let you know I had a bright idea.

    The technique I decribed uses the InternetExplorer control. Due to an error Jon reported to me on my Autosafe tool (which uses the update mechanism) I had a good idea: why not use a web query on one of the worksheets in your add-in. From an Excel perspective, this is much cleaner: no references needed.

    I have added that method to the article (and to Autosafe) now.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.