Generating Mail Message In Macro With A Specified Subject And Body
Aug 3, 2006
I have a form which is going to be used as an aid to staff, I have created Macro's that when clicked enter information in to fields in the worksheet, I would also like the macro to generate an email with a specified Subject and body filled out. At the moment all I have achieved is to generate an email through File - Send to - Mail recipient.
I have also tried to have an email created through Outlook using MAPI, but once again have been unable to create an email with or without a subject and message body. Below is how far I have got in creating an email using MAPI.
This is part of Macro to insert information Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("E12").Select
ActiveSheet.Paste
Call SendAMessage
End Sub......................
View 2 Replies
ADVERTISEMENT
May 9, 2013
My task here is to generate email automatically. When i enter x to run the sub findvalue macro.
Any cells on the column D that has the value of 10 should generate email with the message body, subject and email address automatically.
Example if there are 3 task that are 10 days to deadline, 3 email will be generated after entering "x"
I have edited the Sendmail sub to locate the email's body, subject line and email from the excel.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target = "x" Then
If Not Intersect(Target, Target.Worksheet.Range("G2")) Is Nothing Then
Call Findvalue
End If
End If
End Sub
Code:
Sub Findvalue()
Dim Rng1 As Range
Dim foundemail As Range
Dim a As Variant
Set Rng1 = Range("D2:D10")
For Each a In Rng1
If a.Value = 10 Then
Set foundemail = Sheets("Email").Range("A:A").Find(What:=Cells(Target.Row, 1), _
[Code] .......
View 4 Replies
View Related
Jan 19, 2014
a macro to copy the contents of a selected range in an excel table to an outlook mail generated using a macro.
The only thing is that I need the grid along with the formatting of the selected Excel range.
View 3 Replies
View Related
Aug 10, 2009
I am trying to send out an e-mail from excel with all kinds of combined info. Here is what I have so far, which works to send out an e-mail to a certain address with a compiled subject. No luck with inserting the BODY of the e-mail yet from a certain cell.
=HYPERLINK(CONCATENATE("mailto:",E32,"?subject=",F32))
Also, How do I make the text in each of these cells read "send e-mail" rather than the whole jumbled mess that is currently in there from the combination of the cells?
View 6 Replies
View Related
Jan 3, 2013
I am using a excel macro to send message from excel and i have the code to send the mail, but the body of the mail is coming in a single line but i need to send it in different lines, how to do that.
View 3 Replies
View Related
May 10, 2013
I have an email hyperlink setup on my excel sheet and I would like to automatically (not manually) add a sentence that is another cell (that changes from time to time) to the subject line or the body of the email.
View 1 Replies
View Related
Dec 18, 2008
I use gmail, and have an excel sheet with hundreds of rows. I need to send each recepient an e-mail using their e-mail address (row D), and their name in the body and subject (row A). The rest of the body of the email will all be the same.
View 6 Replies
View Related
Nov 17, 2009
I receive around 40 emails per day, all in the following format:
Subject: "Team x.x - date"
Body text: "x files sent"
where x represents a number.
What I'm hoping to be able to do is drop all these emails into a folder (in .msg format), and use excel to look through them and extract the team number from the subject, and the number of files sent from the body text for each message.
Unfortunately, while I class myself as reasonably competent with excel vba, working with emails or .msg files is new to me, so I genuinely haven't a clue how to do this, or if it's even possible.
View 7 Replies
View Related
Feb 26, 2008
I need to take contents of cells (which are results of formulas and references to other cells) and use the contents to compose an email.
Here are some cells to illustrate. NOTE: the information in brackets is the formula that's contained in the cell, while the text is the result of the formula.
B3 = This is the link used to compose an email.
C19 = abc@domain.com (an email address)
C22 = Login expired on node citrix08. [=concatenate("Login expired on node ",C7,".")]
C25 = Dear Company A, [=concatenate("Dear ",C6,",")]
C27 = The login for citrix08 has expired. [=concatenate("The login for ",C7," has expired.")
C29 = Contact us within 15 days to continue. [=concatenate("Contact us within ",C9," days ...]
C31 = Ticket 444 has been created to track the issue. [=concatenate("Ticket ",C10," has...]
C33 = Lots of other text
D33 = More text
E33 = More text
C48 = Sincerely,
B3 (Named "SEND MAIL") contains the formula used to compose the email from the cells above, however, I cannot add all the cells to the formula without an error. At some point, there is too much data (contained in the referenced cells) and B3 returns #VALUE error.
=HYPERLINK("mailto:" & C19 &"?subject=" & C22 & "&body=" & C25 & "%0D%0A" & "%0D%0A" & C27 & "%0D%0A" & "%0D%0A" & "%0D%0A", "SEND MAIL")
The above formula works now, because it doesn't contain all of the body (of email) I need.
When I click on B3, it properly launches the email client, puts in an address, subject, and two lines of text in the body.
My workaround to this problem is to manually highlight cells C29 through E48, select copy, then go to the partially formed email and paste the rest of the body.
Is there a way to include all the body into an email? I think this can be accomplished with a VBA code, but have no idea how to do it.
I dont want to send the mail, just compose it using cells that have calculated what is needed in the body. I can then read the email, confirm it's content, and click send in the email client manually.
Does anyone have any suggestions? Is there a better (but simple) approach?
I know this could be done via javascript on an html page, but I dont know how to code this at all.
I do know excell quite well and have many cells to calculate what is needed in the body of the email, but, alas,
still can't compose the ENTIRE email from the formula in B3.
View 9 Replies
View Related
Oct 23, 2008
how i can add a second body in an e-mail sent via excel?
Here's the
View 2 Replies
View Related
May 22, 2009
I have this as part of a macro that creates an e-mail
View 2 Replies
View Related
Nov 9, 2012
I have the code which generates email through out look with customized subject and body of the letter, is it possible to insert the image(JPEG or any format) with text (not as an attachment) in body of the email, how to do it.
PHP Code:
If FileName <> "" Then RDB_Mail_PDF_Outlook FileName, "ron@debruin.nl", "This is the subject", _
"This is the body of mail where i want to insert image" _ & vbNewLine & vbNewLine & "Regards Ron de bruin", False
View 5 Replies
View Related
Mar 28, 2014
Normally i am able to send mail using gmail with example text by typing in body field. But I want to send Range(A8:D17) as message body.
First I defined body1 as variable range, then i set body1 as value of my required range in body of message i used variable 'body1' but it is giving error "run-time error '13' , Type mismached "
[Code] .....
Where I need to change in ordger to send mail using range as body .
View 1 Replies
View Related
Feb 7, 2014
I want extract table values from body of email into excel through vba code in outlook.
I want pull table values two kinds of mail format
One is First Part and another is Additional Ordering
I want pull table values for accurate First Part table into First order workbook where saved in path for accurate Additional Part O table into Additional Part workbook,where saved in path.
Find the attachment with code :
Attached Images
PARTS ORDERING.jpg
ADDITION ORDERING.jpg
Attached Files
First Part.xls
Additional Part.xls
View 2 Replies
View Related
Sep 29, 2009
The following will place values found in O19,020,&022 into an e-mail body.
I'm attempting to place a selected range of cells into the body also.
To do this I tried the highlighted section of code below.
View 11 Replies
View Related
Apr 24, 2014
Why the message body is blank.
[Code] .....
View 1 Replies
View Related
Nov 29, 2012
I did this 10 years ago so I admit I am rusty at this but here are what I had in my notes that worked with Excel XP. I am currently using Excel 2010
With ThisWorkbook
.HasRoutingSlip = True
With .RoutingSlip
[Code]....
The last line will send the workbook but I need a Subject and Message to go with it.
View 9 Replies
View Related
Jul 19, 2013
I am having trouble with copy-paste-from-outlook-to-excel routine. Is there a way where I can get a certain text (or numbers, perhaps) from an outlook email message and transfer it to an excel? It is fine to copy and paste one or a hundred emails, but it already exceeds 30 thousand email messages. I just wanted to know is there is a way for me to simplify my work through VBA.
Here is a sample of the email body:
"The lead with phone number 1231234567 is in the federal DNC list and has been rejected. We apologize for any inconvenience this may have caused. This email was automatically generated, please do not reply to it."
In this email body, i wanted to get only the number 1231234567 and paste it in the excel.
View 2 Replies
View Related
Mar 16, 2014
I've set up an email to be sent via a macro (excel 2007 and outlook) and I expanded the body of the message and it now comes up with an error "Compile error: invalid outside procedure"
It was working when I only had 4 lines and now it's not working.
strbody = "Hi," & vbNewLine &_
"abc." & vbNewLine &_
"def." & vbNewLine & vbNewLine & _
"ghi" & InputBox("Enter Response date (dd/mm/yyyy)") & vbNewLine & vbNewLine & _
"jlk." & vbNewLine & vbNewLine & _
"lmn" & vbNewLine & vbNewLine & _
"ABC" & vbNewLine & vbNewLine & _
"XYZ" & vbNewLine & _
[code]....
View 3 Replies
View Related
Jul 6, 2012
I have a spreadsheet with client names, email addresses, and appointment info. I export a .csv file from outlook. I have been doing a mail merge in word and then coping and pasting into an Outlook message and sending it out. I did some reseach and found code that I have made changes to. Of course they it doesn't work. I can't get anything to happen when I run this code.
Code:
Sub Qualls_Email_Confirms()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
[Code] .........
View 3 Replies
View Related
Nov 4, 2009
I am searching for a macro where I can use in a command button to:
1. Launch Outlook
2. Insert variable name from the excel file within the body of the Email.
ex. ...Your new cost is: "NewCost"
View 2 Replies
View Related
May 18, 2014
Trying to add a macro to generate an approval email with certain data from the spreadsheet within the body of the email. I have the following in place currently to deploy the email:
Sub Sendemail()
Dim Email_Subject, Email_Send_To, _
Email_Cc, Email_Body As String
Dim Mail_Object, Mail_Single As Variant
Email_Subject = "New Account Approval"
[Code] ....
What do I need to add the following cell values into the body of the email, All Sheet 1?
B6
B4
B8
F14
E16 : F16
E17 : F17
A25 : B25
A26 : B26
A27 : B27
Is there something simple I can insert to make this work?
View 2 Replies
View Related
Sep 14, 2012
We need to send multiple mail with attachment with outlook 2007 with option "Resend this message", now we want to use excel for sending the mail.
procedure.----------------------------------------------------------------------------------------------------
S.No. To cc----------------------------------------------------------------------------------------------------
1. xyz@ymail.com----------------------------------------------------------------------------------------------------
2. abc@gmail.com hursh@rediffmail.com, hursh@rediffmail.com, hursh@rediffmail.com, raj@hotmail.com----------------------------------------------------------------------------------------------------
3. ram@ymail.com ramesh@gmail.com---------------------------------------------------------------------------------------------------- 4. rajesh@ymail.com----------------------------------------------------------------------------------------------------
5. raghu@ymail.com raju@hotmail.com ---------------------------------------------------------------------------------------------------- 6. info@ymail.com----------------------------------------------------------------------------------------------------
7. ranjit@excel.com xyx@gmail.com----------------------------------------------------------------------------------------------------and
we have two files for attaching on desktop, one is a excel file and second is a zip file. we want to send the mail with excel mail merge.
View 1 Replies
View Related
Jan 27, 2009
I have a spreadsheet with multiple departments on it set out in no particular order, (just as they are added) and this sheet needs to stay like that as a record of when added.
The problem I am having is that I need to generate a bordered blank Weekly, Monthly or 52 week planner for what ever department needs it on a different sheet so it may be printed. This will contain that departments items but leave the days/weeks blank for them to fill out.
As an example I use the code below to loop through the original sheet and generate a 52 Week Planner if the criteia matches.
View 3 Replies
View Related
Jul 17, 2014
I have a the following macro that looks through a range of cells and generates emails based on the date. The macro generates the email but does not insert my signature line.
[Code] .....
View 14 Replies
View Related
Mar 20, 2014
I am new to the VBA editing and I am missing some steps to get my files correctly generated and then ideally saved in PDF format in the same folder.
I have two files; one is an invoice template with the following fields:
Invoice Reference: Line 8 column D
Issue date: Line 9 column D
Client name: Line 11 column E&F
Client address: Line 12 column E&F
Product name: Line 16 column E&F
Product details: Line 18 column E&F
Production date: Line 20 column E&F
Delivery date: Line 22 column E&F
Units: Line 24 column E&F
Total Units: Line 26 column E&F
Total Invoiced: Line 30 column F
Each sheet in the "template" workbook should be named after the Invoice Reference.
Secondly I have the source file in which the data is organized as follows: (Both are in the same folder)
Invoice Reference: column A
Issue date: column B
Client name: column C
Client address: column D
Product name: F
Product details: column G
Production date: column H
Delivery date: column I
Units: column J
Total Units: column J
Total Invoiced: column E
One invoice needs to be created per line in the source workbook. I tried many times the macro recording without getting the correct outputs.
View 5 Replies
View Related
Nov 11, 2009
I have a workbook that has multiple worksheets and I would like to use a command button to e-mail just one selected sheet. I want to create the single sheet as an attachment on a new e-mail message but leave the addressing to the user as it will vary, and not save the single sheet. My challenge is that the users have a variety of different e-mail clients (Outlook, Lotus Notes and others).
View 2 Replies
View Related
May 10, 2014
I tried to add signature code in a macro to send a mail from outlook but failed.
Add signature code in below code.
Signature Code Link.
View 9 Replies
View Related
Jan 17, 2013
I need to send 25 mails on daily basis to my client. All fields in mail are common except recipient and attachments. Every mail has 3 excel attchments. So i created a macro in excel which sends mail as per my requirement but picks up only one attachment from the path i have mentioned in the vb code. Whole macro is running perfectly. I just want to know what modification i should do in that code to attach more than one excel file to the mail from the path i have given. Below is the code:
Sub macro1()
Dim sFolder As String
Dim Folder As Object
Dim file As Object
Dim fso As Object
[Code]....
View 1 Replies
View Related
Apr 29, 2014
I am using this RDB code to send a fixed range to a fixed recipient in the body of an email, but I would like to set it to run for all worksheets.
[Code] .........
View 5 Replies
View Related