I have a macro that sends an email to a list of users. I want to be able to allow the user to select whether to display or send the email via a drop down list. On my worksheet I have a drop down list that has "display" and "send". I thought I could capture that selection using a variable (emailType) and add that to the With OutlookMail section of the code, but I think I'm missing something....
VBA Code:
Sub emailReports()
Dim OutlookApp As Object
Dim OutlookMail As Object
Dim finalRow As Integer
Dim reportDate As String
Dim fileLocation As String
Dim emailRecipient As String
Dim emailType As String
finalRow = Workbooks("HS_Critique_Master V2.xlsm").Worksheets("Sht_data").Cells(Rows.Count, 1).End(xlUp).Row
reportDate = Workbooks("HS_Critique_Master V2.xlsm").Worksheets("Sht_data").Range("E1").Value
emailType = Workbooks("HS_Critique_Master V2.xlsm").Worksheets("Sht_data").Range("emailSelect").Value
For i = 7 To finalRow
emailRecipient = Workbooks("HS_Critique_Master V2.xlsm").Worksheets("Sht_data").Range("F" & i).Value
fileLocation = Workbooks("HS_Critique_Master V2.xlsm").Worksheets("Sht_data").Range("G" & i).Value
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
On Error Resume Next
With OutlookMail
.To = emailRecipient
.CC = ""
.BCC = ""
.Subject = "HotShop Critique - " & reportDate
.Body = "Hello, please review the attached Hotshop Critique file for " & reportDate
.Attachments.Add (fileLocation)
.emailType
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Next i
...