The project I just finished is using late-binding. The
only reason is to simplify the auto build process to
support different versions of Outlook.
The code would look like:
Dim oApp ' VBA
Dim oApp As Object ' VB6
Set oApp = CreateObject("Outlook.Application")
...
Set oApp = Nothing
Hi Bingo,
> Dim oApp ' VBA
For VBS, ok, but why for VBA?

Signature
Viele Grüße
Michael Bauer
The project I just finished is using late-binding. The
only reason is to simplify the auto build process to
support different versions of Outlook.
The code would look like:
Dim oApp As Object ' VB6
Set oApp = CreateObject("Outlook.Application")
...
Set oApp = Nothing
>-----Original Message-----
>Hi Tom,
>
>Late Binding means that you declare all object variables
As Object
>instead of the proper object type. In this case you
don´t need to
>reference the Outlook library.
>
>Anyway, if you are not familiar with the OOM, I would
suppose that you
>set a refenrence on Outlook while developing. After
developing you can
>remove this. Only with a reference set you can use the
object browser
>(F2), which shows you all available methods etc.
>
>Create an Outlook instance with the CreateObject method,
a MailItem with
>the CreateItem method. Declarations and samples for
using these methods
>you will find easily via the object browser.
>
>Please see also http://www.outlookcode.com/d/sec.htm for
the upcoming
>security warnings.
>
>> Using Office XP and wish to email to Outlook from
Access using vba -
>am
>> advised that usage of late binding would be preferable
rather that
>setting
>> reference to Outlook
>>
>> Does anyone have an example of the appropriate code
please
>> TIA
>>
>> Tom
>
>.
Bingo - 28 Jan 2005 19:43 GMT
VBScript indeed. :-)
>-----Original Message-----
>Hi Bingo,
[quoted text clipped - 62 lines]
>
>.
Tom - 29 Jan 2005 07:47 GMT
Thanks for your input, have tried your suggestions as per code below - it
will not compile last line saying user type not defined - what do I have to
declare olMailItem as?
Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim objOutlookAttach As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
Tom
VBScript indeed. :-)
>-----Original Message-----
>Hi Bingo,
>
>> Dim oApp ' VBA
>
>For VBS, ok, but why for VBA?
message
>news:088b01c50545$eb2b1a40$a501280a@phx.gbl...
>
[quoted text clipped - 57 lines]
>
>.
Michael Bauer - 29 Jan 2005 09:37 GMT
Hi Tom,
> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
with late binding you need to declare your own constants, i.e.
olMailItem from the Outlook Library is unknown for your app.

Signature
Viele Grüße
Michael Bauer
> Thanks for your input, have tried your suggestions as per code below - it
> will not compile last line saying user type not defined - what do I have to
[quoted text clipped - 82 lines]
> >
> >.
Tom - 29 Jan 2005 09:43 GMT
Michael
Can you give me an example as to the best way to do this please
Tom
> Hi Tom,
>
[quoted text clipped - 91 lines]
>> >
>> >.
Michael Bauer - 29 Jan 2005 15:41 GMT
Hi Tom,
sorry, VBS is not my language and I´ve just read that constants aren´t
possible. That is you need to use the numeric value (0 for olMailItem).

Signature
Viele Grüße
Michael Bauer
> Michael
>
[quoted text clipped - 7 lines]
> > with late binding you need to declare your own constants, i.e.
> > olMailItem from the Outlook Library is unknown for your app.
Tom - 29 Jan 2005 18:03 GMT
Michael
Where can I find the numeric values for or do you know them for:
olTo
olCC
olBCC
tia
Tom
> Hi Tom,
>
[quoted text clipped - 12 lines]
>> > with late binding you need to declare your own constants, i.e.
>> > olMailItem from the Outlook Library is unknown for your app.
Michael Bauer - 29 Jan 2005 18:21 GMT
Hi Tom,
please set (for developing purposes only) a reference on the Outlook x.0
Library and open the object browser, as i mentioned earlier. You can
then type in all the constants you need and see their values below in
the description pane.

Signature
Viele Grüße
Michael Bauer
> Michael
>
[quoted text clipped - 3 lines]
> olCC
> olBCC
Tom - 29 Jan 2005 19:28 GMT
Michael
Brilliant!! - thanks very much for your help
Tom
> Hi Tom,
>
[quoted text clipped - 10 lines]
>> olCC
>> olBCC
Ken Slovak - 31 Jan 2005 14:57 GMT
Once you have those Const values you can then define them in your VBS code
if you want using a Const declaration. VBS does support constant
declarations.

Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
> Michael
>
> Brilliant!! - thanks very much for your help
>
> Tom