Dear Jegatheesan
Remove the On Error Resume Next to see how it fails.
Maybe your ExportPath = Range("B11").Value does not end in "\" ?
Maybe FileName:=ExportPath & FName & ".xls" adds ,xls again. ?
Regards
Derek ++
>________________________________
> From: "j_excel@ymail.com" <j_excel@ymail.com>
>To: ExcelVBA@yahoogroups.com
>Sent: Thursday, 3 May 2012, 11:49
>Subject: [ExcelVBA] macro help
>
>
>
>Hi
>i am using below macro code, mail will sent but attachement not add, i cound't where i made mistake so anybody help me
>
>i have generated report from saved path
>C:\Documents and Settings\z004497\Desktop\Desktop Files2\macro working\OutputData\
>
>saved file path
>C:\Documents and Settings\z004497\Desktop\Desktop Files2\macro working\OutputData\october.xls
>
>B11 - ExportPath
>B18 - FName
>
>macro code:
>Sub Mail_Workbook()
>Application.DisplayAlerts = False
>Application.ScreenUpdating = False
>Dim OutApp As Object
>Dim OutMail As Object
>Dim ExportPath As String
>Dim FName As String
>Set OutApp = CreateObject("Outlook.Application")
>Set OutMail = OutApp.CreateItem(0)
>On Error Resume Next
>ExportPath = Range("B11").Value
>FName = Range("B18").Value
>With OutMail
>.To = "xxxxx"
>.CC = ""
>.Subject = "xxxxx"
>.Body = "xxxxxxxxxx"
>.Attachments.Add FileName:=ExportPath & FName & ".xls"
>.Send
>
>End With
>On Error GoTo 0
>Set OutMail = Nothing
>Set OutApp = Nothing
>Application.DisplayAlerts = True
>Application.ScreenUpdating = True
>End Sub
>
>mail will sent but attached not add, can u anybody help me
>
>Thanks
>Jegatheesan
>
>
>
>
>
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar