ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add reference to Outlook library programmatically (https://www.excelbanter.com/excel-programming/418840-add-reference-outlook-library-programmatically.html)

Hiran

Add reference to Outlook library programmatically
 
Hi,
Can someone tell me how to programmatically add a reference to a
library (Outlook, in my case) ?

Thanks,
Hiran


Ron de Bruin

Add reference to Outlook library programmatically
 
Hi Hiran

Why not use Late binding

I use it here for example
http://www.rondebruin.nl/mail/folder2/mail2.htm

See the info about Early binding below the macro


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Hiran" wrote in message ...
Hi,
Can someone tell me how to programmatically add a reference to a
library (Outlook, in my case) ?

Thanks,
Hiran


Chip Pearson

Add reference to Outlook library programmatically
 
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
wrote:

Hi,
Can someone tell me how to programmatically add a reference to a
library (Outlook, in my case) ?

Thanks,
Hiran


Hiran

Add reference to Outlook library programmatically
 
Thanks Ron and Chip. You guys are priceless!
Hiran

Hiran

Add reference to Outlook library programmatically
 
Chip,
I'm now trying to use this to add the ADO2.8 library (msado 15.dll)
and I get Run-time error '48' 'Error in loading DLL'.
What am I missing?
Thanks,
Hiran




All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com