Attaching an Outlook Library programatically

  • Thread starter Richard Buttrey
  • Start date
R

Richard Buttrey

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
__________________________
 
R

Richard Buttrey



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
__________________________
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top