“Could not load an object because it is not available on this machine”

Article contributed by Dave Rado

If a user gets this error message (before a single line of code has run – and with nothing being highlighted when you go into debug mode, even when you try stepping through your code using F8) - it almost certainly means that there is a userform somewhere in your project with a reference to something (such as Microsoft Calendar) that is not installed on their machine.

As a first step, compare the references on their machine with those on yours.  If you see one on theirs which says “missing”, you're well on the way to fixing the problem (copy the relevant file to their machine and register it).   Or if there is a reference on your machine whuch doesn't appear on theirs, you're equally well on your way to fiixing the problem.

There is an additional “gotcha” to be aware of, however.  If you create a reference to the Microsoft Calendar 8.0 Object Library using Word  97, and then subsequently save your project in Word 2000, Word gets it's knickers in a twist.  It seems to change the reference on the fly from Calendar 8.0 to Calendar 9.0, and provided the user has Microsoft Calendar installed your code runs okay.

But it does not display the reference to either version of Calendar under Tools + References.   And if Calendar isn't installed, it won't show up as missing.  Which makes troubleshooting difficult, to say the least, especially as you may get the above error message even when running a module which never even calls the userform containing the calendar control.

So if you get the above error message but can't see any missing references in the list, that may mean there is a missing reference to an old version of a DLL or OCX.   In which case you have to go through all your modules, looking for any code that references something which is not ticked in the list of references.  When you find it, you're there.