D
dkschoonover
I'm trying to send an auto-email from Access and get the perverbial "Allow
Access" prompt. I've looked at http://www.outlookcode.com/d/sec.htm as some
have suggested, but don't understand it (programming newbie here). Can
anyone help me wrap my head around this? (Note: I can't use CDOMail due to
security restrictions)
The Code I'm using (from another posting) is:
Sub SendMessageNew(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' 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("[recipient]")
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("[recipient]")
objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Test"
.HTMLBody = "I'm new at this"
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing("C:\test.txt") Then
Set objOutlookAttach = .Attachments.Add("C:\test.txt")
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
Access" prompt. I've looked at http://www.outlookcode.com/d/sec.htm as some
have suggested, but don't understand it (programming newbie here). Can
anyone help me wrap my head around this? (Note: I can't use CDOMail due to
security restrictions)
The Code I'm using (from another posting) is:
Sub SendMessageNew(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' 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("[recipient]")
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("[recipient]")
objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Test"
.HTMLBody = "I'm new at this"
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing("C:\test.txt") Then
Set objOutlookAttach = .Attachments.Add("C:\test.txt")
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub