0
votes

I created a macro in Outlook which needs Word and Excel references. It has to work on different versions of Office (2007, 2010, 2013). I have Office 2013, so when I "install" macro (copy VBAProject.otm) on 2007 and 2010 I have missing references. I wanted to add references manually using code similar to this in Excel:

ThisWorkbook.VBProject.References.AddFromFile

but I couldn't find anything like that. I searched internet, but I also failed. Can anyone tell me if in Outlook VBA is possible to add reference from file?

1

1 Answers

1
votes

To use unreferenced libraries and avoid setting references on each users' computer you access them by creating objects via late binding. This is typically done using the CreateObject method e.g for the scripting runtime you'd use:

Dim fso as object

Set fso = CreateObject("Microsoft.ScriptingRuntime")

You can search online for how to late bind the particular reference you require.