Send emails through outlook 2007

G

Guest

I have a word doc that can generate emails and send out them through outlook.
it works fine when I use outlook 2003(I chose yes when the outlook security
asked me if I want to send mail).
but after I upgrade to office 2007, even after I select "allow" on security
warning, I check sent folder, there is no email sent out. and the receiver
does not receive emails.

What should I do to let macros in a word doc sending emails through outlook
2007?

Thanks a lot! have a great day!
 
G

Guest

I run the code step by step. there is no error when I debug it.
the code is like this:

Private Sub SendEmail_Click()

Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem

.To = (e-mail address removed)
.CC = "Scheduler"
.Subject = "subject"
.Body = "Meeting Generated Task" + Chr(13) +
"-----------------------------------" + Chr(13)

'Add flag
.FlagDueBy = ActiveDocument.FormFields("End_Date").Result
.FlagStatus = olFlagMarked
.FlagIcon = olRedFlagIcon
.Categories = ActiveDocument.FormFields("Categories").Result
.Send
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub
 
G

Guest

I changed the code .send to .display. the generated mail showed up in
outlook2007. but .send function seems not been performed.

Whan should I do? Thanks a lot.
 
G

Guest

I fixed it. the problem caused by the cc field. I have two people in
scheduler. so the mail did not send out.

I found this problem by changing send to display, then clicked on send
button. the mail did not send out because the system asked me to comfirm
which scheduler i'd like to send to. I deleted that cc line then it works
fine.

Thank you very much. Have a great day!
 
G

Guest

If you comment out Send and use thet Display method instead it will of course
not send the e-mail until the user clicks the Send button!

Try commenting out all the MailItem properties you are setting except the
..To and .Subject lines, and try the Send method again. I have a hunch
something is wrong with either the Cc, Body, Categories or Flag properties -
but nothing that's obviously apparent.

Is 'Scheduler' resolved if you manually type that in the To: field?

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top