Macro To Send Email In Excel
Mar 20, 2014
Im looking to create a reporting mechanism for a shared worksheet that im putting together.
I am looking to create some that will automatically create an email (either through outlook, or using a userform) and automatically populate with my email address in the 'To' section and automatically populate the subject with 'Error/Info Change'. The user can then populate the main email body with whatever they want to notify me of.
Im then hoping that the code can be run through a macro which has been added to the quick access toolbar.
View 2 Replies
ADVERTISEMENT
May 21, 2014
How to modify the below vba code? It sends an email with an attachment right away after pressing the macro button. I would like the user to see the email in outlook before it gets send... and then press 'send' in Outlook .....
Sub Mail_ActiveSheet()
'Working in Excel 2000-2013
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
Dim FileExtStr As String
Dim FileFormatNum As Long
[Code] .....
View 1 Replies
View Related
Aug 11, 2014
creating a macro to send email from excel through Outlook basis of different conditions and with embedded text and subject.
There 2 workbooks attached with this post. The workbook named "Data" contains the data and the workbook named "Emails" contains the Dealer Names (in Column A), the Email ids of the contact person (Column B, C and D), the subject (in Column E) and mail content (in Column F).
I need a Macro which first split the data basis of "Dealer Name" Column F into multiple sheets from "Data" sheet. Now, each sheet will contain only the Individual dealer's data. The data whose ageing is 2 or more than 2 days (in Column H) is highlighted in yellow.
Now, I need to send a separate email to dealers with their data details from range A to F (including headers) as an embedded text with subject and mail content which is present in "Emails" workbook.
Now the twist is, if any dealer having the Aging value in Column H is 2 or more than 2 days (highlighted in yellow color) than the email should be sent in CC to Column D email ids but if there is no Aging more than 2 days than the email should be sent in CC to Column C email ids.
"To" email ids (in Column B), subject (in Column E) and mail body (in Column F) will remain same in both conditions. Column A is containing the Dealer Names through which macro will identify the email ids.
View 4 Replies
View Related
Aug 15, 2014
I am trying to make an inventory list with the expiry date of various chemicals. There is a user form which I have not coded yet. What I hope to do is have the macro send an email regarding which chemical is expiring within 90 days to a group of people.
View 3 Replies
View Related
Jan 22, 2013
I have a template invoice in excel. What I want is a macro code that when it is run the open template invoice should be sent to a specific email address !!
View 5 Replies
View Related
Sep 3, 2012
I am using 2007. This may be something simple but I can't seem to find a solution to this, I have an excel macro enabled workbook which produces a daily report the final task is to save and send an email but I need the file to save as an xls rather than xlsx as some of the recipients are unable to open the file here is the code used for the tasks in the
workbook:Sub Step1_Refresh()
'
' Step1_Refresh Macro
'
'
ActiveWorkbook.RefreshAll
End Sub
Sub step2_save_close()
[Code] ........
View 1 Replies
View Related
Sep 3, 2012
I am using 2007, I have an excel macro enabled workbook which produces a daily report the final task is to save and send an email but I need the file to save as an xls rather than xlsx as some of the recipients are unable to open the file.
Here is the code used for the tasks in the:
workbook:Sub Step1_Refresh()
'
' Step1_Refresh Macro
'
'
[Code]....
View 7 Replies
View Related
Sep 7, 2008
I used Scheduled Task to set up my spreadsheet to open daily. I have the code with assistance to pull out the due date items and place them into an email.
I have come across XLSTART/AUTOEXEC/ACTIVATE...ETC...
But cannot figure out the code that will automatically "enabling macro" once Scheduled Task opens the spreadsheet?
Then once the macro runs, the email with the due dates, how can this auto send without user interaction?
(currently I would have to hit send)
I am trying to make the process totally automated to open the spreadsheet at a certain time, send the email with due dates and close the spreadsheet.
Following code in ThisWorkbook--
Private Sub Workbook_Open()
Check_Date_Send_Mail
End Sub
Code in Module1--
Option Explicit
Sub Check_Date_Send_Mail()
Dim wbBook As Workbook
Dim wsSheet As Worksheet
Dim rnDate As Range, rnValue As Range
Dim stAddress As String, stMsg As String
Dim stRecipient As String, stSubject As String
Dim stPost As String
Set wbBook = ThisWorkbook
Set wsSheet = wbBook.Worksheets("Sheet1")
With wsSheet
Set rnDate = .Range("d2:t23")
End With
View 9 Replies
View Related
Aug 23, 2012
I've been using a macro successfully for the last couple of years, but this morning when I went to use it, it decided to fail. I have a workbook which contains various spreadsheets. The macro that has failed performs the following tasks:
1. It copies a list of email addresss from an external workbook to a sheet in the current workbook (still works)
2. It copies the referral sheet I want to send to a new file, and saves it with an appropriate filename to an appropriate folder (still works)
3. The macro then creates an email with a standard subject line, attaches the new worksheet and emails it to each of the addresses as above (broken)
The error message is from Microsoft Visual Basic. "Run-time error '1004': Mail system failure. Check your mail installation."
I'm guessing there is a setting somewhere in Excel that has changed as part of an update.
I've been through a number of the options in the developer menu to remove any obvious restrictions (& reopened excel afterwards), but so far it hasn't resolved the problem.
For what it's worth, here is the macro code.
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Run "PullInSheet1"
Dim oldbook As String
[Code] .......
In case you're wondering about the pullinsheet code, I'll add it below - but I probably grabbed it from this forum a couple of years ago (like some of the above) & just made some changes.
Code:
Sub PullInSheet1()
Dim AreaAddress As String
'''''' Sheet11.UsedRange.Clear
Dim ClRange As String
ClRange = "= 'L:ADMINEMPLOY SERVICES" _
[Code] ........
There are a couple of things I've wanted to do to improve the macro, but I couldn't justify the need to spend time working it out (since writing spreadsheets isn't really my job). Since it's broken at the moment, I can...
1. I'd like to create a subject line that reflects the name of the person being referred. For some reason though, anything other than text in the cell reference caused an error for me. eg, I tried using concatenate to create my subject line, but it didn't work.
2. I'd like the copied sheet to contain all of the formatting of the original sheet. Presumably there is a paste option that will do this and I just picked the wrong one.
The mailsystem we use is Groupwise 8. I couldn't find any settings in that program that have been changed, or that I could change.
I should change the extension from xls to xlsx in the code since I'm using Excel 2010 (but changing it doesn't fix the problem).
View 4 Replies
View Related
Oct 10, 2011
I have a macro that will send an excel workbook by email when an image is 'Clicked on' however, I need the attachment to be renamed as the text used in cell B9 of this worksheet.
So far I have the macro below which auto populates the 'email to' address and the 'subject' line which is great but how do I get to rename the attachment?
Sub SendIt()
Application.Dialogs(xlDialogSendMail).Show
arg1:="test@test.com", _ arg2:="test 1" End Sub
View 2 Replies
View Related
Jan 6, 2012
I'm using some code to send an email from Excel to Outlook via VBA, I of course got it from [URL]
I'm using it to send a mass email to some of our customers, it uses information from a sheet and then attach's some PDF files totalling 5MB.
The trouble I'm having is that I can send around 16 emails and then the mailbox reaches it's limit and it just comes to a halt until I can empty the 'Sent Items' and then the 'Deleted Items' folder.
I've spoke to the tech guys here at work about it and they seem to be doing a lot of shaking their heads about increasing the size of the mailbox () so I'm wondering if I can the routine automatically delete the email once it's been sent... ?
Here's the code I've got dealing with the mail;
Code:
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
[Code].....
View 1 Replies
View Related
Feb 3, 2012
I have a macro that is currently set up to save a draft of my email from Excel. Feedback I've received from my peers is that they would like this macro to Open the drafted email it creates instead of the user having to navigate to the draft folder to open it up.
Is there a part of the code below I can modify so this happens?
//Sub Mail_workbook_Outlook_1()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
[Code]....
View 1 Replies
View Related
Apr 20, 2013
I am trying to make a macros for sending an email through excel using outlook.
The body of the email should contain ..(The following case has been processed and ready for Quality Check and also picks the case# from Cell "C3" and "D3")
The subject line should say "Case Processed and take the case # from Cell "B2".
It should also show the "To" Field and "CC" too.
View 2 Replies
View Related
May 15, 2014
I can send email from excel (Outlook). I want to send the same email "To" and "CC" with "category" and the same email with "BCC" with out "category".
I know how can i send email "To", "CC" and "BCC" with category.
View 3 Replies
View Related
May 21, 2009
I use a script to send email from excel. The script is perfect however there is one nagging problem. Everytime an email is sent, outlook keeps on asking me for permission that a program is automatically trying to send an email.
How do I get around this and disable this notification?
The code is reproduced below
Public Sub SendEmail()
ESubject = "Reorder Material"
Dim totalR As Integer
Dim r As Integer
FinalRow = Range("A65536").End(xlUp).Row
totalR = FinalRow - 5
View 9 Replies
View Related
Mar 26, 2009
I have found the below mentioned code from one of the threads.
Sub EmailDoc()
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olMail As MailItem
Set olMail = olApp.CreateItem(olMailItem)
Application.ScreenUpdating = False
With olMail
.To = Range("A1").value
.SentOnBehalfOfName = """xyz"" "
.Subject = "Resources"
'.Attachments.Add "D: estxyz.xls"
.send
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
The above code works fine but i want to send emails to all the names in my column A in the To field and in the CC field from column D (It shoulds send if there are any values for the CC field)
View 9 Replies
View Related
Nov 16, 2008
Is it possible to send an email if an error occurs with all the information regarding that error? I've created a workbook with a lot of macros and a lot of information. It's used by several people and sometimes those people have several other excel workbooks open and running at the same time. I've done my best to fix all the bugs but should one come up I'd like to be able to have the workbook send me an email alerting me of the error and the details surrounding the error such as what the error was, what macro was running, ranges selected, all that useful info. Is this even possible? or is there some sort of work around to at least bring up a prompt or page for the user to fill out then send by email after the error occurred?
View 2 Replies
View Related
Oct 31, 2011
I am currently sending email to a few people from excel using the outlook and excel connectivity.
The issue is I have to individually define a module for each person I send an email to and it is extremely inefficient.
My attachment makes it clear.
There is 3 tabs in the workbook.
Tab 1 (Method 1) is what I am currently using and I know it extremely inefficient
Tab 2 (Method 2) is what I would like to use
* When I select a cell and click send email, I would like for that person to be sent the email
* When I select a range of cells, I would like all of those individuals to be sent an email
Tab 3 (Email) is what I would like Method 2 to use - this tab includes a subject line and the email body. It sends the message in the email tab to the recipients I have selected in Tab 2.
View 7 Replies
View Related
Aug 4, 2014
I have my data in column A as Reminder Description and in column B as Due Date.
I was wishing to send an email using excel 2007 with outlook using excel vba... I want to send email 2 days before due dates and also i want excel to type in when the email was sent... Is this possible....???
A B C D E
Reminder Description Due Date Send Email1 Send Email2 Send Email3
Insurance due date is 06/08/14 06/08/14 04/08/14 05/08/14 06/08/14
Also can this vba code be executed whenever workbook opens....???
View 1 Replies
View Related
Feb 12, 2014
I need to send an Outlook email from within an Excel sheet. I have a command button with the following codes:
-----------------------------------------------------------------------------------------------
Sub SendEmail_Inactive()
Dim OutApp As Object
Dim OutMail As Object[code].....
I need to be able to add more text/paragraphs in the Body of the email including bullet points
View 1 Replies
View Related
Jul 11, 2012
Code:
Sub email()
Dim myOutlook As Object
Dim myMailItem As Object
Dim FName As String
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
FName = ActiveWorkbook.Path & "" & ActiveWorkbook.Name
[Code] .....
This code runs fine in order to send an e-mail from outlook while i'm in excel. I would like to change it a bit
The excel has 4 sheets.
The third sheet is named "new items".
In this sheet in COLUMN K i have numbers and empty cells.
What i would like is when in COLUMN K number "7" exists then copy the enire row- and all other rows with "7" to a new excel named "new items" and send an e-mail to specific receipients with "new items" attached.
I will change the code above in order to run this macro by workbook.open()
Plus i'm thinking of adding a message box if no "7"'s exist.
View 4 Replies
View Related
Nov 30, 2012
I am trying to find a way of sending an email when a something comes out of date.
View 9 Replies
View Related
Mar 15, 2014
I need to send emails and have the "Direct Replies To" field updated to a different address.
This is my code. I've remarked what I tried, which is NOT working.
VB:
Dim OutApp As Object
Dim OutMail As Object
Dim EmailBody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
[Code] .....
View 3 Replies
View Related
Jul 2, 2014
Using excel and outlook 2010 I have a spread sheet I open everyday. I am in sales and its a lead monitoring and tracking excel sheet that I use everyday. So excel and outlook remaining open is not an issue...
I simply have rows of customers with their details such as name, email, date last contacted, date to follow up on.
How do I get code that will send an automated email using outlook to that specific customer, preferably with their name in the email, when the follow up date I chose arrives?
So for example, I talked to David today and I know I would like to just send a "checking in" generic email on a date I selected in a few days.
How do I get excel and outlook to do this automatically?
View 14 Replies
View Related
Feb 21, 2012
send the sheet to an email address based on the email address in a cell.
The cell populates from a dropdown list a user selects.
The email will be sent to myself, and one authoriser. If a second authoriser is required then the first authoriser will send this on. I'm trying to make this simple, so when a user clicks a 'send' button on the form this happens automatically.
The code I'm using to send to myself is
Application.Dialogs(xlDialogSendMail).Show arg1:="bibbyd01@myemailaddress.com", _
arg2:="Auth Details"
Nice and easy. So how do I replace that email addres with the email address in a cell? I assume I have to create a DIM to hold the data, then use it to populate the address field?
I'm using excel 2007 if it makes any difference.
View 1 Replies
View Related
Mar 7, 2014
I have an excel workbook (Excel 2010) consisting on 30 sheets, I would like to add a command button to one (1) of the sheets that would attach just that sheet and not the whole workbook to my Outlook 2010 email, is this possible. What would the code look like.
View 1 Replies
View Related
Jun 21, 2014
I need the VBA code to automate my repeated task. I have the range of 100 rows and has the date field in a column and i need a macro to extract the rows for three previous days starting from today.
View 2 Replies
View Related
Feb 13, 2009
I would like a macro that recognises the cell colour in column F if it is yellow i would like a standard email to be created & sent to the corresponding customer email address in column D. is this even possible??
View 14 Replies
View Related
Sep 21, 2013
macro visual basic and trying to do a simple report wherein i can send an email auto matically.
View 2 Replies
View Related
Feb 14, 2014
So i want to be able to send a single Excel sheet to a recipient, not already pre-defined in the VBA. I am trying to get to where i can click a button/link and a window pops up, asking me to enter recipient's email address. When I enter the address and press- 'Send', the email is sent using Outlook.
View 4 Replies
View Related