![]() |
Attaching an Outlook Library programatically
I have a workbook which is distributed to many users. I'd like to
build into it a procedure which would automatically save the Wb, attach it to an email and send it back to me. One of the difficulties I've found is that I can't guarantee that all users have an Outlook Object Library selected. Hence when the procedure starts with the usual declaration:- Dim oOutlookObj as Outlook.Application the user gets the error message 'Compile error: User-defined type not defined' Leaving aside the illogicality of that statement, is there any way that the Object Library can be attached programatically? i.e the equivalent of manually selecting Tools References and then clicking the Outlook Object Library in the VBA window TIA __ Richard Buttrey Grappenhall, Cheshire, UK __________________________ |
Attaching an Outlook Library programatically
Richard,
Just use late binding. See http://www.xldynamic.com/source/xld.EarlyLate.html -- HTH RP (remove nothere from the email address if mailing direct) "Richard Buttrey" wrote in message ... I have a workbook which is distributed to many users. I'd like to build into it a procedure which would automatically save the Wb, attach it to an email and send it back to me. One of the difficulties I've found is that I can't guarantee that all users have an Outlook Object Library selected. Hence when the procedure starts with the usual declaration:- Dim oOutlookObj as Outlook.Application the user gets the error message 'Compile error: User-defined type not defined' Leaving aside the illogicality of that statement, is there any way that the Object Library can be attached programatically? i.e the equivalent of manually selecting Tools References and then clicking the Outlook Object Library in the VBA window TIA __ Richard Buttrey Grappenhall, Cheshire, UK __________________________ |
Attaching an Outlook Library programatically
On Wed, 3 Aug 2005 23:34:46 +0100, "Bob Phillips"
wrote: Richard, Just use late binding. See http://www.xldynamic.com/source/xld.EarlyLate.html Bob, Thanks for this. I've come across the terminology 'late / early binding' before whilst reading various books and articles on VBA, but always parked it in the 'too hard to understand just at the moment', category. I've just had a quick look at the URL above and it looks like I now need to get to grips with it and expand my understanding :-( Regards __ Richard Buttrey Grappenhall, Cheshire, UK __________________________ |
Attaching an Outlook Library programatically
Richard,
It can get very technical if you delve into the mechanics of what is happening with late and early binding, but the application is very simple, especially if you use the technique described in that article, you get the best of both worlds. -- HTH RP (remove nothere from the email address if mailing direct) "Richard Buttrey" wrote in message ... On Wed, 3 Aug 2005 23:34:46 +0100, "Bob Phillips" wrote: Richard, Just use late binding. See http://www.xldynamic.com/source/xld.EarlyLate.html Bob, Thanks for this. I've come across the terminology 'late / early binding' before whilst reading various books and articles on VBA, but always parked it in the 'too hard to understand just at the moment', category. I've just had a quick look at the URL above and it looks like I now need to get to grips with it and expand my understanding :-( Regards __ Richard Buttrey Grappenhall, Cheshire, UK __________________________ |
All times are GMT +1. The time now is 02:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com