I run this macro from a file that I have stored in dropbox. It creates 40+ emails and works flawlessly at my office, but each time I have run it from my laptop it creates the emails, but the emails are stuck in my outbox until I open them up, individually, and click on the send button. Both computers are using Win7, both are using Office 2010 and both computers have up to date security software. My office desktop is using Microsoft Security Essentials and my laptop is using Norton Live 360. I have noticed that the copy of the emails in my sent files show the email addressee's differently: emails sent from the office show the addressee as
xxx@mailsomewhere.com whereas the emails sent from my laptop show he addressees as 'xxx@mailsomewhere.com' (the single quotes). Any ideas?
By the way, this macro reads from a worksheet that lists the email addressees, the report the addressee is to receive, the outlook template to use and determine if they have unsubscribed.
xxx@mailsomewhere.com whereas the emails sent from my laptop show he addressees as 'xxx@mailsomewhere.com' (the single quotes). Any ideas?
By the way, this macro reads from a worksheet that lists the email addressees, the report the addressee is to receive, the outlook template to use and determine if they have unsubscribed.
PHP:
Sub MailReports()
Dim emailRept As String, emailItem As String, addReport As String, emailAddr As String, unSub As String
Dim OutApp As Object, OutMail As Object
' ScreenUpdating = False
Set cSheet = Sheets("PrintAndMail")
Set OutApp = CreateObject("Outlook.Application")
pathToReports = Application.ActiveWorkbook.Path & "\@DPC_Daily_Reports\"
fDate = WorksheetFunction.Text(Range("B3").Value, "MMDDYY")
subjDate = WorksheetFunction.Text(Range("B3").Value, "MM/DD/YY")
lstEmailRow = Range("I2").End(xlDown).Row - 1
' read worksheet with email addresses, the title of the report to attach, the email template to use.....
For i = 1 To lstEmailRow
emailAddr = Range("I1").Offset(i, 0).Value
emailRept = Range("I1").Offset(i, 1).Value & ".pdf"
emailItem = Range("I1").Offset(i, 2).Value
unSub = Range("I1").Offset(i, -3).Value
If unSub = "C" Then GoTo skipMail
fName = fDate & "_" & emailRept
addReport = pathToReports & fName
useOFT = pathToReports & emailItem
Set OutMail = OutApp.CreateItemFromTemplate(useOFT)
On Error Resume Next
With OutMail
.To = emailAddr
.Subject = "DPC Report for " & subjDate
.Attachments.Add (addReport)
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
skipMail:
Next i
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub