If users are on 64bit Office with Office 16 the below code works fine but how do I account for users on different versions and 32bit also?
Sub Add_References_Programmatically()
Dim VBAEditor As Object
Dim vbProj As Object
Dim chkRef As Object
Set VBAEditor = Application.VBE
Set vbProj = ActivePresentation.VBProject
On Error Resume Next
vbProj.References.AddFromGuid "{0002E157-0000-0000-C000-000000000046}", 5, 0
On Error GoTo 0
For Each chkRef In vbProj.References
If chkRef.Name = "Excel" Then
GoTo CleanUp
End If
Next chkRef
vbProj.References.AddFromFile "C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE"
CleanUp:
Set vbProj = Nothing
Set VBAEditor = Nothing
End Sub