Hello,
how to attach the file to email in that case ? Range I10 contains the file name, which is changing once file updated. I need declare variable some how here ?
how to attach the file to email in that case ? Range I10 contains the file name, which is changing once file updated. I need declare variable some how here ?
Code:
Sub Mail_With_Attch[B]
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="H:\PARs\" & Range("I10").Value, OpenAfterPublish:=False[/B]
Sheets("DataIn").Select
Range("I10").Select
Fname = Selection.Text
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "PAR"
.CC = ""
.BCC = ""
.Subject = Sheets("PAR").Range("I10").Value
.Body = "Dear All, please find attached PAR for " & Namesx & ". And have a nice day! Thank you "
.Attachments.Add ("H:\PARs\" & Fname".pdf") ' [B]WHAT IS WRONG HERE ?[/B]
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Last edited: