設定引用項目-VBA

                  Attribute VB_Name = "設定引用項目"
Sub AddReference_old()
On Error Resume Next
'
'   Dim vbProj As VBProject
'
'   Set vbProj = ActiveWorkbook.VBProject
'   vbProj.References.AddFromFile "C:\Program Files\Microsoft Office\Office14\MSWORD.OLB"
    Application.ThisWorkbook.VBProject.References.AddFromFile "C:\Program Files\Microsoft Office\Office14\MSWORD.OLB"
    'Application.ThisWorkbook.VBProject.References.VBE.VBProjects
End Sub


Sub AddReference()
On Error Resume Next
With Application.VBE.ActiveVBProject.References
    .AddFromFile "C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\VBE6EXT.OLB"
    .AddFromFile "c:\program files\microsoft office\office14\msword.olb"
End With
'http://www.mrexcel.com/forum/excel-questions/590567-use-visual-basic-applications-install-excel-reference.html
''http://support.microsoft.com/kb/308340/zh-tw
'   Dim vbProj As VBProject
'
'   Set vbProj = ActiveWorkbook.VBProject
'   'vbProj.References.AddFromFile "C:\TestFiles\Refme.dot"
'   vbProj.References.AddFromFile "c:\program files\microsoft office\office14\msword.olb"
''按一下 [工具] 功能表上的 [設定引用項目],然後將參考加入 Microsoft Visual Basic for Applications Extensibility 5.3 程式庫中。此程式庫包含參考 VBA 專案的物件。
''"C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6"
End Sub


Sub AddReference()
On Error Resume Next
With Application.VBE.ActiveVBProject.References
    .AddFromFile "C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\VBE6EXT.OLB"
    .AddFromFile "c:\program files\microsoft office\office14\msword.olb"
End With
'http://www.mrexcel.com/forum/excel-questions/590567-use-visual-basic-applications-install-excel-reference.html
''http://support.microsoft.com/kb/308340/zh-tw
'   Dim vbProj As VBProject
'
'   Set vbProj = ActiveWorkbook.VBProject
'   'vbProj.References.AddFromFile "C:\TestFiles\Refme.dot"
'   vbProj.References.AddFromFile "c:\program files\microsoft office\office14\msword.olb"
''按一下 [工具] 功能表上的 [設定引用項目],然後將參考加入 Microsoft Visual Basic for Applications Extensibility 5.3 程式庫中。此程式庫包含參考 VBA 專案的物件。
''"C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6"
End Sub