Hi,
I have used code below to add a form that can send emails via my Access 2000 database.
I have a couple questions. I used the code and the email would only send if i had MS Outlook open. Can it send if the user doesn't have MS Outlook open? It looks like it has been sent while Outlook is closed but it only sends when you open Outlook later.
Also I get a message that says "A program is trying to send an email on your behalf......." You have to click yes to accept to send the email. Is there anyway to bypass or remove this message. Can the user get rid of this display either in properties or can i get rid of it in code.
Thanks.
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("#email addresses go here separated by ;#"
' .CC = "#cc address - optional#"
' .Subject = "#subject line#"
' .Body = "#main message goes here#"
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
If editmessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
I have used code below to add a form that can send emails via my Access 2000 database.
I have a couple questions. I used the code and the email would only send if i had MS Outlook open. Can it send if the user doesn't have MS Outlook open? It looks like it has been sent while Outlook is closed but it only sends when you open Outlook later.
Also I get a message that says "A program is trying to send an email on your behalf......." You have to click yes to accept to send the email. Is there anyway to bypass or remove this message. Can the user get rid of this display either in properties or can i get rid of it in code.
Thanks.
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("#email addresses go here separated by ;#"
' .CC = "#cc address - optional#"
' .Subject = "#subject line#"
' .Body = "#main message goes here#"
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
If editmessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing