Tuesday, May 25, 2010

I'm looking to set up an automatic daily email to my team pulling one cell of data from excel. ?

Hi,


I'm looking to set up an automatic daily e-mail sent to my team pulling one cell of data from excel.I can standardize the message, but that piece of data will change every day. I've tried different options but can't seem to find a solution. Any help would be much appreciated!
I'm looking to set up an automatic daily email to my team pulling one cell of data from excel. ?
Here's an Excel macro that should do it.





The way it's currently set up to work (you could change this) is that it will take 4 email addresses from cells A1:A4 and create an email with the value from B1 in the message body.





To install the macro...


Alt+F11 to open the VB editor


Insert\Module


Paste the code below in the edit window.


Back in Excel, run the macro or put a button from the forms toolbar on your sheet and assign this macro to it.











Private Declare Function ShellExecute _


Lib "shell32.dll" _


Alias "ShellExecuteA" _


(ByVal hwnd As Long, _


ByVal lpOperation As String, _


ByVal lpFile As String, _


ByVal lpParameters As String, _


ByVal lpDirectory As String, _


ByVal nShowCmd As Long) As Long





Sub SendEmail()


Dim Email As String, Subj As String


Dim Msg As String, URL As String





' email addresses


Email = Range("A1").Value %26amp; ";" %26amp; _


Range("A2").Value %26amp; ";" %26amp; _


Range("A3").Value %26amp; ";" %26amp; _


Range("A4").Value





' Subject of the email


Subj = "The subject of the email"





' Message of the email


Msg = "Message body of the email. " %26amp; _


"This is today's Sales figure... $" %26amp; _


Range("B1").Value





'Create the URL


URL = "mailto:" %26amp; Email %26amp; _


"?subject=" %26amp; Subj %26amp; "%26amp;body=" %26amp; Msg





'Execute the URL (start the email client)


ShellExecute 0%26amp;, vbNullString, URL, _


vbNullString, vbNullString, vbNormalFocus





End Sub











You can define the Subject and Message of the email by assigning what you want to the Subj and Msg variables in the code.

No comments:

Post a Comment

 


set up email © 2008. Design by: Pocket Web Hosting