I am using below macro to generate an outlook email using data from my "data.xls" file.
As I run the macro, it creates my resulted email & close my data.xls file without warning me.
I want to update this macro as it do not close my data.xls file.
By all other means this macro is fine.Can anyone answer how to update it that it doesnt close my excel file with data.
Sub RFQ()
Application.Goto Reference:="R6C1"
Selection.Copy
Range("A7").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Dim OutApp As Object: Set OutApp = CreateObject("Outlook.Application")
Dim OutMail As Object: Set OutMail = OutApp.createitem(0)
Dim stFname As String
Dim cell As Range
On Error Resume Next
For Each cell In Range("A1:A5")
With OutMail
.To = Range("c1")
.CC = Range("c3")
.BCC = Range("c2")
.Subject = Range("n1")
.Body = Range("n2")
.display
End With
Next cell
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Bookmarks