📜  excel vba 以编程方式添加引用 - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:56.614000             🧑  作者: Mango

代码示例1
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