Hey guys and girls,
My Access email macro is looping through and launching duplicate email windows until I tell manually stop it. Can't figure out why it is looping, any help would be appreciated. Database that has several forms that all link to a navigation from.
Option Compare Database
Public Sub SendEmailP()
Dim strEmail, strBody, strsubject As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'**creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
'**************************************************************
'*create string with email address
strEmail = txtEmail
strBody = [Forms]![navigation]![NavigationSubform].[Form]![EmailVerbiage]
strsubject = [Forms]![navigation]![NavigationSubform].[Form]![EmailSubject]
DoEvents
'***creates and sends email
With objEmail
.To = "[email protected]"
.Subject = strsubject
.body = strBody
.Importance = olImportanceHigh
.FlagRequest = "Read"
.ReminderSet = True
.ReminderTime = Now
.Display
SendKeys "^{END}", True 'moves curser to the end
SendKeys "{End}", True
SendKeys "{Enter}", True
SendKeys "%nas{enter}", True 'to add default signature
Exit Sub
End With
End Sub
Bookmarks