K
Kiknadze Lado
Dear all,
I have excel spreadsheet:
In column A the names of the people
In column B the e-mail Addresses
In column C the Filenames like this C:\Data\Book2.xls This don't have to be
Excel files.
I have the Macro wich loop through each row in Sheet1 and if there is a
E-mail address
and a filename that exist in that row it will create a mail with this
information and send it.
Sub TestFile()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim cell As Range
Application.ScreenUpdating = False
Set olApp = New Outlook.Application
For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Offset(0, 1).Value <> "" Then
If cell.Value Like "*@*" And Dir(cell.Offset(0, 1).Value) <> ""
Then
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = cell.Value
.Subject = "Testfile"
.Body = "Hi " & cell.Offset(0, -1).Value
.Attachments.Add cell.Offset(0, 1).Value
.Send 'Or use Display
End With
Set olMail = Nothing
End If
End If
Next cell
Set olApp = Nothing
Application.ScreenUpdating = True
End Sub
Problem is that for each sending of e-mail it is necessary confirmation and
I have to press button "YES".
How I can avoid pressing on "YES" and to send everything automatically.
Best wishes,
Lado
I have excel spreadsheet:
In column A the names of the people
In column B the e-mail Addresses
In column C the Filenames like this C:\Data\Book2.xls This don't have to be
Excel files.
I have the Macro wich loop through each row in Sheet1 and if there is a
E-mail address
and a filename that exist in that row it will create a mail with this
information and send it.
Sub TestFile()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim cell As Range
Application.ScreenUpdating = False
Set olApp = New Outlook.Application
For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Offset(0, 1).Value <> "" Then
If cell.Value Like "*@*" And Dir(cell.Offset(0, 1).Value) <> ""
Then
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = cell.Value
.Subject = "Testfile"
.Body = "Hi " & cell.Offset(0, -1).Value
.Attachments.Add cell.Offset(0, 1).Value
.Send 'Or use Display
End With
Set olMail = Nothing
End If
End If
Next cell
Set olApp = Nothing
Application.ScreenUpdating = True
End Sub
Problem is that for each sending of e-mail it is necessary confirmation and
I have to press button "YES".
How I can avoid pressing on "YES" and to send everything automatically.
Best wishes,
Lado