![]() |
Body message - email
Sub Mail_workbook_KI()
Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dayrep = InputBox("Enter no. day of report.", Default:="0") Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = Dayrep & "Day Revenue Report" .Body = "'Please find attached the ' & dayrep & ' day report '" .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With Set OutMail = Nothing Set OutApp = Nothing End Sub Having problem with the body message - want it to read: 'Please find attached the 10 day report - if Dayrep=10 Can anybody help pls |
Body message - email
al007,
Double quotes ", instead of single '. Also, Option Explicit is your friend; you would have seen "dayrep" was not being evaluated. NickHK "al007" wrote in message ups.com... Sub Mail_workbook_KI() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dayrep = InputBox("Enter no. day of report.", Default:="0") Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = Dayrep & "Day Revenue Report" .Body = "'Please find attached the ' & dayrep & ' day report '" .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With Set OutMail = Nothing Set OutApp = Nothing End Sub Having problem with the body message - want it to read: 'Please find attached the 10 day report - if Dayrep=10 Can anybody help pls |
Body message - email
It does not work - pls give me correct code
thxs NickHK wrote: al007, Double quotes ", instead of single '. Also, Option Explicit is your friend; you would have seen "dayrep" was not being evaluated. NickHK "al007" wrote in message ups.com... Sub Mail_workbook_KI() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dayrep = InputBox("Enter no. day of report.", Default:="0") Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = Dayrep & "Day Revenue Report" .Body = "'Please find attached the ' & dayrep & ' day report '" .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With Set OutMail = Nothing Set OutApp = Nothing End Sub Having problem with the body message - want it to read: 'Please find attached the 10 day report - if Dayrep=10 Can anybody help pls |
All times are GMT +1. The time now is 04:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com