View Single Post
  #7  
Old August 21st 07, 08:46 PM posted to microsoft.public.outlook.program_vba
david f[_2_]
external usenet poster
 
Posts: 7
Default Send emails through outlook 2007

Thanks a lot! That really helps.
Have a great day

"Eric Legault [MVP - Outlook]" wrote:

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/


"david f" wrote:

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.

"david f" wrote:

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 =
.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


"Eric Legault [MVP - Outlook]" wrote:

Do you have any error handling in your code? Can you step through it without
error?

--
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/


"david f" wrote:

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!

Ads