Selasa, 20 Maret 2012

[MS_AccessPros] Re: Outlook Error

 

Bill, here is the routine. All variables are loaded, but I'm not including an attachment so it is an empty string.

'Open Outlook.
Set olApp = CreateObject("Outlook.Application")
'Open New Email.
Set MailItem = olApp.CreateItem(olMailItem)

With MailItem
'Repeat To and cc lines for each additional recipient.
.To = sTO
.cc = sCC
.Subject = sSUBJ
'vbNewLine is used as a single line return to begin a new row.
.Body = sBODY
'Assign attachments if needed. Otherwise, omit this line.
'Repeat this line for each additional attachment.
If Not Nz(sATTACH, "") = "" Then
.Attachments.Add (sATTACH)
End If
'next line would let MS Outlook API send the note
'without storing it in your sent bin
'.DeleteAfterSubmit = True
.Send
End With

--- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@...> wrote:
>
> Mike
>
> using CreateObject should work even if Outlook is not open. It should only error out if Outlook is not installed.
>
> Care to share the entire routine? maybe something else needs fixing.
>
> Regards,
> Bill Mosca, Founder - MS_Access_Professionals
> http://www.thatlldoit.com
> Microsoft Office Access MVP
> https://mvp.support.microsoft.com/profile/Bill.Mosca
>
>
>
>
> --- In MS_Access_Professionals@yahoogroups.com, mithomas48 <no_reply@> wrote:
> >
> > When sending an email, I noticed that even though I use a line to create an instance of Outlook, I get an Application or Object defined error if I DO NOT physically have Outlook open. Below is the syntax being used to create the instance of Outlook. Shouldn't we be able to create the object and send the email even if Outlook is not opened?
> >
> >
> > Set olApp = CreateObject("Outlook.Application")
> >
> > Thanks in advance!
> > Mike
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar