PC Review


Reply
Thread Tools Rate Thread

Automating Outlook from Access, with late binding

 
 
Dale Fye
Guest
Posts: n/a
 
      2nd Feb 2009

I have users using one of my applications that are running Office 2003 and
2007. To avoid reference problems, I was hoping to use late binding to
automate sending a message with attachments from within Access. The code I'm
currently using (below) requires the appropriate reference. Can anyone
provide recommendations for modifications to this to allow late binding?

Dim omail As Outlook.MailItem
Set omail = CreateItem(olMailItem)
omail.Subject = "Email with attachment"
omail.Attachments.Add strFileName, 1
omail.Display
Set omail = Nothing

--
Dale

email address is invalid
Please reply to newsgroup only.

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      2nd Feb 2009
Try:

Const oMailItem As Long = 0

Dim oOutlook As Object
Dim omail As Object

Set oOutlook = CreateObject("Outlook.Application")
Set omail = oOutlook.CreateItem(olMailItem)
omail.Subject = "Email with attachment"
omail.Attachments.Add strFileName, 1
omail.Display
Set omail = Nothing
oOutlook.Quit
Set oOutlook = Nothing


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Dale Fye" <(E-Mail Removed)> wrote in message
news:6A2BECC9-7776-472B-B8EB-(E-Mail Removed)...
>
> I have users using one of my applications that are running Office 2003 and
> 2007. To avoid reference problems, I was hoping to use late binding to
> automate sending a message with attachments from within Access. The code
> I'm
> currently using (below) requires the appropriate reference. Can anyone
> provide recommendations for modifications to this to allow late binding?
>
> Dim omail As Outlook.MailItem
> Set omail = CreateItem(olMailItem)
> omail.Subject = "Email with attachment"
> omail.Attachments.Add strFileName, 1
> omail.Display
> Set omail = Nothing
>
> --
> Dale
>
> email address is invalid
> Please reply to newsgroup only.
>



 
Reply With Quote
 
Tom Wickerath
Guest
Posts: n/a
 
      3rd Feb 2009
Hi Dale,

I show an example of doing this on page 19 of a Word document that I call
"Access Links.doc". You are welcome to download a copy from here:

http://www.accessmvp.com/TWickerath/


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/ex...tributors.html
__________________________________________

"Dale Fye" wrote:

>
> I have users using one of my applications that are running Office 2003 and
> 2007. To avoid reference problems, I was hoping to use late binding to
> automate sending a message with attachments from within Access. The code I'm
> currently using (below) requires the appropriate reference. Can anyone
> provide recommendations for modifications to this to allow late binding?
>
> Dim omail As Outlook.MailItem
> Set omail = CreateItem(olMailItem)
> omail.Subject = "Email with attachment"
> omail.Attachments.Add strFileName, 1
> omail.Display
> Set omail = Nothing
>
> --
> Dale
>
> email address is invalid
> Please reply to newsgroup only.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating Outlook from Access, with late binding Dale Fye Microsoft Outlook VBA Programming 2 3rd Feb 2009 12:23 AM
late binding to Access 2007 Garry Robinson - Access MVP Microsoft Access VBA Modules 4 18th Mar 2007 04:00 AM
Late binding to access COM+ =?Utf-8?B?V29uZGVy?= Microsoft C# .NET 2 15th Feb 2006 03:11 PM
Can't programmatically access a custom Outlook form in C# (late binding problem) Scott English Microsoft C# .NET 7 21st Sep 2004 03:55 PM
Automating Late Binding Object to a Control runningdog Microsoft Dot NET 6 14th May 2004 10:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:39 PM.