Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Send emails through outlook 2007 (http://www.outlookbanter.com/outlook-vba/55185-send-emails-through-outlook-2007-a.html)

david f[_2_] August 21st 07 06:40 PM

Send emails through outlook 2007
 
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!

Eric Legault [MVP - Outlook] August 21st 07 07:40 PM

Send emails through outlook 2007
 
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!


david f[_2_] August 21st 07 08:10 PM

Send emails through outlook 2007
 
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!


david f[_2_] August 21st 07 08:18 PM

Send emails through outlook 2007
 
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!


david f[_2_] August 21st 07 08:34 PM

Send emails through outlook 2007
 
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!

"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!


Eric Legault [MVP - Outlook] August 21st 07 08:36 PM

Send emails through outlook 2007
 
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!


david f[_2_] August 21st 07 08:46 PM

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!



All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com