E-Mail a Worksheet Selection. How?

eddy

Well-known Member
Joined
Mar 2, 2002
Messages
521
Hi
I have a worksheet open called CopySheet
I need to :-
a) Copy a worksheet selection (Range B1 -E38) to the clipboard.
c) Open Outlook
d) Select recipient from the address book.
e) Paste the clipboard contents into the text area.
Is it possible to this with a macro?
Thanks Ted
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hit Ted...
I think you are using office 2000?
Select your range and click on the email icon.
I sent you a test email.
Let me know if it works ok and I'll see if I can come up with the code to do it as well...
Tom
This message was edited by TsTom on 2002-04-21 05:22
 
Upvote 0
And in code:

Add Microsoft Outlook Object Library by selecting VBA_Tools_References then use this code:

'This sub set the range
Sub CallSub()
Dim newRange As Range
Set newRange = Sheet1.Range("B4:D7")
Call CreateNewEmail(newRange)
End Sub

'This sub creates a new email message and fill the subject and also body as your range data
Sub CreateNewEmail(myRange As Range)
Set myOLApp = New Outlook.Application
Dim myOLItem As Outlook.MailItem
Set myOLItem = myOLApp.CreateItem(olMailItem)
With myOLItem
.Subject = "Here is subject"
For i = 1 To myRange.Rows.Count
For j = 1 To myRange.Columns.Count
tmptext = tmptext & " " & myRange.Cells(i, j).Value
Next j
tmptext = tmptext & vbCrLf
Next i
.Body = tmptext
End With
myOLItem.Display
End Sub


It is possible to play with this more and select To: etc in code.

Regards
 
Upvote 0
Thanks Tom / Smozgur

Still trying to get the code to work this end.
Will let you know how it goes.
Tom I haven,t got your test mail
Thanks all!
Ted
 
Upvote 0
Hi Smozgur / Tom

Your code works really well Smozgur and it's lightning fast! I need to retain the formatting though of the original sheet as it's not plain text I am sending but a quotation which has columns Qty and Description with total Equipment,VAT and Total + VAT calls at the bottom. If the formatting could be sorted then thats the answer to all my E-Mail problems. Maybe if it were sent as HTML or a picture it may solve the problem! Is that possible
Regards Ted
 
Upvote 0

Forum statistics

Threads
1,214,570
Messages
6,120,294
Members
448,953
Latest member
Dutchie_1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top