|  | excel macro mail send |  | |
| | | Nayab |  |
| Posted: Mon Sep 01, 2008 11:49 am Post subject: Re: excel macro mail send |  |
On Sep 1, 2:38 pm, "KisH \(Tihomir\)" <kish89MA...@gmail.com> wrote:
| Quote: | "Per Jessen" <per.jes...@mail.dk> wrote in message
news:eqEZoHADJHA.5196@TK2MSFTNGP04.phx.gbl...
Hi
Substitute the "msg=..." line with the code below:
For Each cell in Range("txt") Msg=Msg & cell.Value Next
Hello, Thanks for your help but I got this error on your code:
Run-time error '1004': Application-defined or object-defined error
I'm using Excel 2007
|
I checked it and the solution suggested is fine. However I get an error 1004 when I try to access a named range which does not exist. So check the name of the named range you are using. |
| |
| | | Ron de Bruin |  |
| Posted: Mon Sep 01, 2008 6:33 pm Post subject: Re: excel macro mail send |  |
| |  | |
See LINK
If you use Outlook you have better options See LINK
--
Regards Ron de Bruin LINK
"KisH (Tihomir)" <kish89MAKNI@gmail.com> wrote in message news:g9ev1d$leh$1@localhost.localdomain...
| Quote: | Hello, I'm using this vb macro code for sending mail. --------------------------------------------------------------- Sub mailto_Selection() Dim Email As String, Subj As String, cell As Range Dim response As Variant Dim msg As String, url As String Email = "" 'create list below Subj = "Family Newsletter" msg = "Here needs to be named range from excel(some text)" '-- Create the URL
For Each cell In Selection Email = Email & cell.Text & "; " Next cell
url = "mailto:" & Email & "?subject=" & Subj & "&body=" _ & Replace(msg, Chr(10), "/" & vbCrLf & "\") url = Left(url, 2025) 'was successful with 2025 , not with 2045 '-- Execute the URL (start the email client) ActiveWorkbook.FollowHyperlink (url) Application.Wait (Now + TimeValue("0:00:10")) Application.SendKeys "%s"
End Sub -------------------------------------------------------------------------
Problem is that I don't know how to add named range(text) from excel to mail body. Ex. In sheet1 I have text: Bla bla bla Bl bl bl B b b This text is named as named range "txt". So, in this line of code " msg = "Here needs to be named range from excel(some text)" ", msg needs to have value of named range "txt".
How to do that?
Thank you!
|
|
| |
|
|