smpayne69
01-04-2006, 08:16 AM
I have a macro that runs and report then uses the SendObject function to send the report via email. However, I want the entire process to be automated but am getting the following warning before it is sent, where I have to click YES:
"A program is trying to automatically send e-mail on your behalf. Do you want to allow this?
If this is unexpected, it may be a virus and you should choose No"
Anyone out there that can help??
Thanks!
KenHigg
01-04-2006, 08:38 AM
Have you tried to use docmd.sendobject? I use this and don't get the messages... Just a thought. :)
smpayne69
01-04-2006, 08:51 AM
I will give it a try, thanks.
smpayne69
01-04-2006, 09:00 AM
Still giving me the same warning message. :(
Any other thoughts?
KenHigg
01-04-2006, 09:05 AM
Hmm... Not really. Here's sample of one of mine:
DoCmd.SendObject acSendQuery, "selEmail_01", acFormatXLS, txtStringTo, txtStringCC, txtStringBCC, "Outstanding Parts Alert (" & rst!customer_id & ")", txtString, False
Looks like I use all the options...
Hayley Baxter
01-13-2006, 04:33 AM
Have a look at the link below.
http://www.outlookcode.com/d/sec.htm
Hay
ghudson
01-13-2006, 05:47 AM
Interesting link. Thanks!
miguel vasquez
01-19-2006, 08:28 AM
I have a macro that runs and report then uses the SendObject function to send the report via email. However, I want the entire process to be automated but am getting the following warning before it is sent, where I have to click YES:
"A program is trying to automatically send e-mail on your behalf. Do you want to allow this?
If this is unexpected, it may be a virus and you should choose No"
Anyone out there that can help??
Thanks!
I want to use the SendObject to attach two objects in the same email?
Can anybody help me?::(
miguel vasquez
01-25-2006, 06:46 AM
I need to send 2 objects in 1 email? please, please help!!!
Hayley Baxter
01-26-2006, 01:16 AM
You can't send multiple objects using sendobject. The code below will allow you to add multiple attachments to your message.
Sub SendMessage(DisplayMsg As Boolean, Optional AttachmentPath1 As String,
Optional attachmentpath2 As String)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("test@test.com")
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("test@test.com")
objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Sandra Daigle")
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "This is the body of the message." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachmentPath1) Then
.Attachments.Add AttachmentPath1
End If
If Not IsMissing(attachmentpath2) Then
.Attachments.Add attachmentpath2
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
End With
Set objOutlook = Nothing
End Sub
Hay
miguel vasquez
01-26-2006, 07:21 AM
Hay,
I use groupwise not outlook, can I use the same code? can I specify the table or query name on this code? how can I create the Sub sendMessage?
Thanks a bunch!!!
Hayley Baxter
01-26-2006, 09:15 AM
I have never used Groupwise but the following link may help you to achieve this, there is a sample attached
http://www.mvps.org/access/modules/mdl0059.htm
Hay