I have macro that builds and attaches files from a folder that is designated. The problem is an excel file gets added to that folder that I don't need when my email gets generated. can you instruct the code to ignore attaching that file. that way I don't have manually delete it every time the email is generated. this is what I have that send the email.
The file is Named "rawsurveys.xls"![]()
EDir = Sheet24.Range("av2").Value For Each Cell In ActiveWorkbook.Sheets("Noralis Email Gen (3)").Range("ai4:ai41") If Cell.Value Like "?*@?*.?*" Then strto = strto & Cell.Value & ";" End If Next Cell If Len(strto) > 0 Then strto = Left(strto, Len(strto) - 1) With Application .EnableEvents = False .ScreenUpdating = False End With Set rng = Nothing Set rng = Range("u4:ab7") Set fso = CreateObject("scripting.filesystemobject") ' This will create an email in Outlook Set olApp = CreateObject("Outlook.Application") Set olEmail = olApp.CreateItem(0) ' Setup retrieval of attachments folder Set fso2 = CreateObject("Scripting.FileSystemObject") Set fsFolder = fso.GetFolder(EDir) ' Display and create the properties of the email With olEmail .Display .To = strto .CC = "" .BCC = "" .Subject = Range("v10") .HTMLBody = RangetoHTML(rng) & .HTMLBody For Each fsFile In fsFolder.Files .Attachments.Add EDir & fsFile.Name Next End With On Error GoTo 0
thanks
Bookmarks