Access 2000 Outlook 2007

  • Follow


I'm trying to email from Access 2000 using the following:

    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment

    Set objOutlook = CreateObject("Outlook.Application")
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    With objOutlookMsg
            Set objOutlookRecip = .Recipients.Add("Email addresses separated 
by semicolons")
            objOutlookRecip.Type = olTo
            .Subject = "Whatever subject"
            .Body = "Whatever message text"
           For Each objOutlookRecip In .Recipients
               objOutlookRecip.Resolve
           Next
           .Display
    End With

    Set objOutlook = Nothing
    SendMessage = True

This process always worked fine with Outlook 2000 and then Outlook 2003; 
however, in Outlook 2007, I get an Error 287 (Object definition error).  I 
was using Outlook Library 11.0, previously, but now some users are using 
Outlook 2007 instead of '03.  When I put the program on a machine with 2007, 
however, the Library 12.0 is showing as referenced in my code-behind 
(appearing to have grabbed automatically)...  The machine I actually 
developed the app on has Outlook 2003, and only some of the users will have 
2007, and I manually had chosen the 11.0 library.  Any ideas on how to 
resolve this would be helpful. 


0
Reply bh 9/17/2007 4:30:11 PM

Your code looks OK and shouldn't need anything more than the new reference 
unless there is a problem with permissions. Try the code on my website:

http://www.datastrat.com/Code/OutlookEmail.txt
-- 
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"bh" <NoSpam@ReplyToGroup.com> wrote in message 
news:e4kMZgU%23HHA.3548@TK2MSFTNGP06.phx.gbl...
> I'm trying to email from Access 2000 using the following:
>
>    Dim objOutlook As Outlook.Application
>    Dim objOutlookMsg As Outlook.MailItem
>    Dim objOutlookRecip As Outlook.Recipient
>    Dim objOutlookAttach As Outlook.Attachment
>
>    Set objOutlook = CreateObject("Outlook.Application")
>    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>
>    With objOutlookMsg
>            Set objOutlookRecip = .Recipients.Add("Email addresses 
> separated by semicolons")
>            objOutlookRecip.Type = olTo
>            .Subject = "Whatever subject"
>            .Body = "Whatever message text"
>           For Each objOutlookRecip In .Recipients
>               objOutlookRecip.Resolve
>           Next
>           .Display
>    End With
>
>    Set objOutlook = Nothing
>    SendMessage = True
>
> This process always worked fine with Outlook 2000 and then Outlook 2003; 
> however, in Outlook 2007, I get an Error 287 (Object definition error).  I 
> was using Outlook Library 11.0, previously, but now some users are using 
> Outlook 2007 instead of '03.  When I put the program on a machine with 
> 2007, however, the Library 12.0 is showing as referenced in my code-behind 
> (appearing to have grabbed automatically)...  The machine I actually 
> developed the app on has Outlook 2003, and only some of the users will 
> have 2007, and I manually had chosen the 11.0 library.  Any ideas on how 
> to resolve this would be helpful.
> 


0
Reply Arvin 9/17/2007 8:46:18 PM


1 Replies
222 Views

(page loaded in 0.449 seconds)


Reply: