Try something like
Sub AddOutlookRef()
' reference current installed version of Outlook
On Error Resume Next 'ignore if already set
ThisWorkbook.VBProject.References.AddFromGuid _
GUID:="{00062FFF-0000-0000-C000-000000000046}", _
major:=0, Minor:=0
End Sub
You can add a reference to any file if you know the file name:
Sub AAA()
ThisWorkbook.VBProject.References.AddFromFile _
Filename:="C:\Path\FileName.ext"
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Tue, 21 Oct 2008 09:49:47 -0700 (PDT), Hiran <(E-Mail Removed)>
wrote:
>Hi,
>Can someone tell me how to programmatically add a reference to a
>library (Outlook, in my case) ?
>
>Thanks,
>Hiran