Send a range in Excel as the body of an Outlook Express message

K

Katie

Is Outlook Express can send a range in Excel as the body like Outlook?

I would like to write a marco to send a range in Excel with Outlook Express use Copy and Paste.

I have find some code from the Internet as the following:

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
Dim r As Integer, x As Double
Dim katie As Variant

Email = (e-mail address removed)

' Message subject
Subj = "Price List"

' Compose the message
Worksheets("Sheet1").Activate
ActiveSheet.UsedRange.Copy

Application.SendKeys "{Tab}{Tab}{Tab}{Tab}{Tab}^{End}{Return}{Return}^v" <== "I would like to paste the range in the body but don't know how to do that."


Msg = <==



' Replace spaces with %20 (hex)
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

' Replace carriage returns with %0D%0A (hex)
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg

' Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus





End Sub

Is there any way to paste the range as the body of the message other then sendkey?

Thanks.
 
N

Norman Jones

Hi Katie,

See :

http://www.rondebruin.nl/sendmail.htm


While there, look at Ron de Bruin's SendMail addins.


---
Regards,
Norman



Is Outlook Express can send a range in Excel as the body like Outlook?

I would like to write a marco to send a range in Excel with Outlook Express
use Copy and Paste.

I have find some code from the Internet as the following:

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
Dim r As Integer, x As Double
Dim katie As Variant

Email = (e-mail address removed)

' Message subject
Subj = "Price List"

' Compose the message
Worksheets("Sheet1").Activate
ActiveSheet.UsedRange.Copy

Application.SendKeys
"{Tab}{Tab}{Tab}{Tab}{Tab}^{End}{Return}{Return}^v" <== "I would like to
paste the range in the body but don't know how to do that."


Msg = <==



' Replace spaces with %20 (hex)
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

' Replace carriage returns with %0D%0A (hex)
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf,
"%0D%0A")
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg

' Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString,
vbNormalFocus





End Sub

Is there any way to paste the range as the body of the message other then
sendkey?

Thanks.
 
R

Ron de Bruin

Hi Katie
Is there any way to paste the range as the body of the message other then sendkey?
Not really with OE

For a small range you can use this
http://www.rondebruin.nl/mail/oebody.htm

But if you are using Win 2000 or windows XP look at this page
http://www.rondebruin.nl/cdo.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


Is Outlook Express can send a range in Excel as the body like Outlook?

I would like to write a marco to send a range in Excel with Outlook Express use Copy and Paste.

I have find some code from the Internet as the following:

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
Dim r As Integer, x As Double
Dim katie As Variant

Email = (e-mail address removed)

' Message subject
Subj = "Price List"

' Compose the message
Worksheets("Sheet1").Activate
ActiveSheet.UsedRange.Copy

Application.SendKeys "{Tab}{Tab}{Tab}{Tab}{Tab}^{End}{Return}{Return}^v" <== "I would like to paste the range in the body but don't know how to do that."


Msg = <==



' Replace spaces with %20 (hex)
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

' Replace carriage returns with %0D%0A (hex)
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg

' Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus





End Sub

Is there any way to paste the range as the body of the message other then sendkey?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top