I created a program on my work computer which runs Microsoft Office 2016 however, my colleague cannot use the VBA program because it doesn't have the updated object library. Specifically, the Date and Left function prevent the program from working.
If they are running a 2010 version of Microsoft Office, is it possible to update their Object Libraries?
You can't use references to newer libary version using an older version as it can provide functions that the older version don't have, just the other way around it could work (old reference with new libary as they are usually backward compatible).
If one reference is broken, all other are not loaded too. That's why the
VBA
functionsDate
andLeft
fail as the libary is not loaded.To get independent of the
Office
version use Late-Binding, but even then you can't use new functions on old versions (just use the subset of the oldest version you want to support or check for version and if the it is too old display a message that the faeture that uses the function is not availible for thisOffice
version).You can develop
Early-Bound
to haveIntellisense
and object browser and switch toLate-Bound
before distributing.Object
CreateObject
Example:
changes to:
You can download a module with enums for
Outlook 2013
at Codekabinet (not tested, but they should cover most ofOutlook 2016
) and import to your project or get the values while you areEarly-Bound
from object-browser or just google.