Question : excel vba add reference programmatically
Answered by : vastemonde
Sub Add_Reference() Application.VBE.ActiveVBProject.References.AddFromFile _ "C:\Windows\System32\scrrun.dll"
End Sub
Sub Remove_Reference() Dim oReference As Object Set oReference = Application.VBE.ActiveVBProject.References.Item("Scripting") Application.VBE.ActiveVBProject.References.Remove oReference
End Sub
Source : | Last Update : Sun, 07 Feb 21