A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , ,

Early binding and late binding with attachment





 
 
Thread Tools Display Modes
  #1  
Old June 9th 06, 12:44 AM posted to microsoft.public.outlook.program_vba
Jonathan
external usenet poster
 
Posts: 44
Default Early binding and late binding with attachment

Hi, in MS Access I have the following procedure...

Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
.To = BAE![aEmail]
.subject = BAE![AnaesName] & "'s List"
.Attachments.Add source:=strFile & ".doc", Type:=olByValue,
Position:=1, DisplayName:="Booking List"
.Display
End With

This works fine when the Outlook object library is referenced and each
object is explicitly declared as the Outlook type. For example
Dim objMail as Outlook.MailItem

The problem is that at least one user does not have the same version of MS
Office. So I cannot reference a specific Outlook object library and I declare
each object variable as Object. For example
Dim objMail as Object

I declare each of the Outlook constants as constants.
Const olMailItem As Integer = 0
Const olByValue As Integer = 1

The problem is that when declaring each object as object the line to attach
a file no longer works. There is no error message and no attached file.

Any ideas or suggestions that will assist me to use late binding are
appreciated. :-)

Many thanks
Jonathan
Ads
  #2  
Old June 9th 06, 01:20 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,370
Default Early binding and late binding with attachment

Have you tried using positional parameters rather than named parameters?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Jonathan" wrote in message ...
Hi, in MS Access I have the following procedure...

Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
.To = BAE![aEmail]
.subject = BAE![AnaesName] & "'s List"
.Attachments.Add source:=strFile & ".doc", Type:=olByValue,
Position:=1, DisplayName:="Booking List"
.Display
End With

This works fine when the Outlook object library is referenced and each
object is explicitly declared as the Outlook type. For example
Dim objMail as Outlook.MailItem

The problem is that at least one user does not have the same version of MS
Office. So I cannot reference a specific Outlook object library and I declare
each object variable as Object. For example
Dim objMail as Object

I declare each of the Outlook constants as constants.
Const olMailItem As Integer = 0
Const olByValue As Integer = 1

The problem is that when declaring each object as object the line to attach
a file no longer works. There is no error message and no attached file.

Any ideas or suggestions that will assist me to use late binding are
appreciated. :-)

Many thanks
Jonathan

  #3  
Old June 9th 06, 02:24 AM posted to microsoft.public.outlook.program_vba
Jonathan
external usenet poster
 
Posts: 44
Default Early binding and late binding with attachment

Thanks Sue, problem solved

Cheers
Jonathan Parminter

"Sue Mosher [MVP-Outlook]" wrote:

Have you tried using positional parameters rather than named parameters?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Jonathan" wrote in message ...
Hi, in MS Access I have the following procedure...

Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
.To = BAE![aEmail]
.subject = BAE![AnaesName] & "'s List"
.Attachments.Add source:=strFile & ".doc", Type:=olByValue,
Position:=1, DisplayName:="Booking List"
.Display
End With

This works fine when the Outlook object library is referenced and each
object is explicitly declared as the Outlook type. For example
Dim objMail as Outlook.MailItem

The problem is that at least one user does not have the same version of MS
Office. So I cannot reference a specific Outlook object library and I declare
each object variable as Object. For example
Dim objMail as Object

I declare each of the Outlook constants as constants.
Const olMailItem As Integer = 0
Const olByValue As Integer = 1

The problem is that when declaring each object as object the line to attach
a file no longer works. There is no error message and no attached file.

Any ideas or suggestions that will assist me to use late binding are
appreciated. :-)

Many thanks
Jonathan


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I get early birthday reminders? T Perry Outlook - Using Contacts 0 April 27th 06 07:04 PM
Item type numeric values for Outlook Late Bind GeorgeMar Outlook and VBA 1 March 20th 06 05:05 PM
Late binding sample John Outlook - General Queries 3 February 24th 06 09:32 PM
Late binding sample John Outlook and VBA 3 February 24th 06 09:32 PM
my appt. reminder is opening a day late. How do I change that bg Outlook - Calandaring 0 February 7th 06 04:51 PM


All times are GMT +1. The time now is 08:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Advertising - Credit Counseling - Ringtones - Buy Computers - Loans