good evening, I have 2 questions to ask regarding excel and outlook
1. Below is the vba code i am using below to select a column of email addresses i need to populate outlook with. However in the spreadsheet i have 10 different columns with over 300 names in each column as different mails go to different people. how do i create an input box to identify which column i want to select?
2.rather than creating a new mail i want it to select from a template on our server.
any assistance always greatly received
1. Below is the vba code i am using below to select a column of email addresses i need to populate outlook with. However in the spreadsheet i have 10 different columns with over 300 names in each column as different mails go to different people. how do i create an input box to identify which column i want to select?
2.rather than creating a new mail i want it to select from a template on our server.
any assistance always greatly received
VBA Code:
Sub SendEmail()
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Dim cell As Range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Msg As String
'Create Outlook object
Set OutlookApp = New Outlook.Application
'Loop through the rows
For Each cell In Columns("A").Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*@*" Then
EmailAddr1 = EmailAddr1 & ";" & cell.Value
End If
Next
Msg = Msg & "Please review the following." & vbCrLf
Subj = "LEAD REFERRAL-"
'Create Mail Item and view before sending
Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.SentOnBehalfOfName = "abcd@1234.com"
.BCC = EmailAddr1
.Subject = Subj
.Body = Msg & vbCrLf
.Display
End With
End Sub