Hmm, I had commented out where you set the item back to nothing. Now that I
uncommented that, it really seems like it is actually ABOUT to send my email
without my manual intervention, but at the last step, after I say "Yes, it is
okay to send these emails, it is not a virus" to the security pop-up, an
error message pops up stating "Outlook does not recognize one or more names."
I go to "Debug" and hit has high-lighted the new line of code
"EmailSend.Send" Why does outlook not recognize this???? It recognizes
everything else enough to create the mail item, receipients, subject, body
and attachments correctly. Am I not declaring enough or properly?
Here is my code as it stands:
Private Sub test_click()
Dim EmailApp, NameSpace, EmailSend As Object
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.To = "(e-mail address removed)"
EmailSend.CC = "This is a test to see if the email can be
sent automatically w/o having to hit 'Send'."
EmailSend.Subject = "Final Forced Pickups (w/e 07/30/07)"
EmailSend.Body = "test if sent."
EmailSend.Attachments.Add "\\Zion\Databases\FPU\Final Forced
Pickups.xls"
'EmailSend.Display
EmailSend.Send
Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing
MsgBox "Process complete."
End Sub
worksfire1 said:
I added the line EmailSend.Send to my code and it seems to get me one step
closer, but no cigar! It generates the custom email with the body, subject,
sender, and attachment I desire, but when it gets to the EmailSend.Send line,
a pop-up opens up asking me if I really want to send this? I am sure I can
find a way to get around the pop-up so that I don't have to manually click
"Yes" I really want to send this, but when I manually click it, it still
doesn't send it. It just leaves the message on the screen still waiting for
me to hit "Send". Odd, puzzingly, what am I missing??
UpRider said:
I believe it's
EmailSend.Send
UpRider
worksfire1 said:
I am trying to send a customized report to each of 650 field users that is
generated by Access. The code creates the custom report and generates the
outlook item just fine. But, I have one step left to automate. The
pushing
of the "Send" button 650 times was not fun today! How can I automate the
"sending" of the 650 emails that my looping and mail code already
generate?
Here is my current relevant code:
Dim EmailApp, NameSpace, EmailSend As Object
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.To = rscriteria![login id]
EmailSend.CC = ""
EmailSend.Subject = "Proposed Forced Pickups (w/e
08/06/07)"
EmailSend.Body = ""
EmailSend.Attachments.Add "\\Zion\Databases\FPU\Proposed
Forced Pickups.xls"
EmailSend.Display