hi friends,
how can ido the file send auto when press exit?
thanks
hi friends,
how can ido the file send auto when press exit?
thanks
.
You have not provided enough information to give you assistance.
Please described in more detail what you are attempting to do and ... post a copy of your workbook displaying how your worksheet is arranged.
hi,Sub Mail_workbook_Outlook_1()
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 = ""
.CC = ""
.BCC = ""
.Subject = "test"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
i want when click exit excel the mail will send auto
thanks
.
Please Login or Register to view this content.
Thanks, but how do I get the file sent automatically when a user clicks on Exit?
.
Connect your "EXIT" button to the macro.
Right click on the button ... select the macro name and click OK.
Next time you click no the button, the macro runs and the email is sent ... so long as you have MS Outlook on your computer.
Sorry but I did not understand what and where I should add to the macro command.
I want when the user exits the excel (exits the software) it will send
Thank you.
.
In the ThisWorkbook module, add this :
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
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 = "Test TO"
.CC = "Test CC"
.BCC = "Test BCC"
.Subject = "test"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
.Display '<<---- Comment out "Display" and uncomment " '.Send " when you are
'.Send 'ready to send emails
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
thank you vey much
i have error-
Attachment 706301
The attachment did not come through.
Please use the GO ADVANCED button below the REPLY window. Then click on MANAGE ATTACHMENTS.
now its work,i found the problem
but i want the excel cell copy in body of mail, how i do it?
Please Login or Register to view this content.
.
Which cell ?
Another question please-
I want that if "yes" is selected it will save and leave the file without sending an email
How to perform?
Thank you.
.
Your posted code indicates you want the workbook attached and not to have a range pasted in the message body.
Do you still want the workbook attached ?
.
Please Login or Register to view this content.
.
Paste this in Module 1 :
Please Login or Register to view this content.
Paste this in ThisWorkbook Module :
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks