Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Pasting from Excel to Outlook with VBA code

Hi,

I am trying to Copy the contents of an Excel worksheet into an Outlook
mail item, like a simple copy and paste.

Is there any code that can do this, I have examples that can populate
from the worksheet but I need it to be in a table format.

Can anyone help??

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Pasting from Excel to Outlook with VBA code

Hi spences10

Try this
http://www.rondebruin.nl/mail/folder3/mail2.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi,

I am trying to Copy the contents of an Excel worksheet into an Outlook
mail item, like a simple copy and paste.

Is there any code that can do this, I have examples that can populate
from the worksheet but I need it to be in a table format.

Can anyone help??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Pasting from Excel to Outlook with VBA code

Hi Ron,

This is fantastic!! thank you very much. There is one thing however, I
need to be able to add some text at the top of the e-mail. Oh and is it
possible to add an auto signature to the mail as well?


Ron de Bruin wrote:
Hi spences10

Try this
http://www.rondebruin.nl/mail/folder3/mail2.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi,

I am trying to Copy the contents of an Excel worksheet into an Outlook
mail item, like a simple copy and paste.

Is there any code that can do this, I have examples that can populate
from the worksheet but I need it to be in a table format.

Can anyone help??


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Pasting from Excel to Outlook with VBA code

Check out this first
http://www.rondebruin.nl/mail/folder3/signature.htm

Must go now but get back to you this evening
Let me know if the second example is working for you

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi Ron,

This is fantastic!! thank you very much. There is one thing however, I
need to be able to add some text at the top of the e-mail. Oh and is it
possible to add an auto signature to the mail as well?


Ron de Bruin wrote:
Hi spences10

Try this
http://www.rondebruin.nl/mail/folder3/mail2.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi,

I am trying to Copy the contents of an Excel worksheet into an Outlook
mail item, like a simple copy and paste.

Is there any code that can do this, I have examples that can populate
from the worksheet but I need it to be in a table format.

Can anyone help??


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Pasting from Excel to Outlook with VBA code

Hi Ron,

Thanks again for your help, I am struggling at the moment though.

Using the code supplied by yourself I have managed to paste from the
workbook into an outlook mail item, but adding a text string is proving
difficult as I can only have either the pasted item or the text string
but not both. = (

Sub MailDiscretionRequest()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim Rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim StrBody As String

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set Rng = Nothing
'Set Rng = ActiveSheet.UsedRange
'You can also use a sheet name
Set Rng = Sheets("DiscretionRequest").Range("DiscReq")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

StrBody = "Hi Colin, discretion request for your attention." &
vbNewLine & vbNewLine

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = RangetoHTML(Rng)
'.Body = StrBody
'.Send
.Display
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

thanks,

Scott Spence
Ron de Bruin wrote:
Check out this first
http://www.rondebruin.nl/mail/folder3/signature.htm

Must go now but get back to you this evening
Let me know if the second example is working for you

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi Ron,

This is fantastic!! thank you very much. There is one thing however, I
need to be able to add some text at the top of the e-mail. Oh and is it
possible to add an auto signature to the mail as well?


Ron de Bruin wrote:
Hi spences10

Try this
http://www.rondebruin.nl/mail/folder3/mail2.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi,

I am trying to Copy the contents of an Excel worksheet into an Outlook
mail item, like a simple copy and paste.

Is there any code that can do this, I have examples that can populate
from the worksheet but I need it to be in a table format.

Can anyone help??





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Pasting from Excel to Outlook with VBA code

Hi Scott

Use this line

StrBody = "Hi Colin, discretion request for your attention." & "<br<br"

And this

.HTMLBody = StrBody & RangetoHTML(rng)


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message oups.com...
Hi Ron,

Thanks again for your help, I am struggling at the moment though.

Using the code supplied by yourself I have managed to paste from the
workbook into an outlook mail item, but adding a text string is proving
difficult as I can only have either the pasted item or the text string
but not both. = (

Sub MailDiscretionRequest()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim Rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim StrBody As String

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set Rng = Nothing
'Set Rng = ActiveSheet.UsedRange
'You can also use a sheet name
Set Rng = Sheets("DiscretionRequest").Range("DiscReq")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

StrBody = "Hi Colin, discretion request for your attention." &
vbNewLine & vbNewLine

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = RangetoHTML(Rng)
'.Body = StrBody
'.Send
.Display
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

thanks,

Scott Spence
Ron de Bruin wrote:
Check out this first
http://www.rondebruin.nl/mail/folder3/signature.htm

Must go now but get back to you this evening
Let me know if the second example is working for you

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi Ron,

This is fantastic!! thank you very much. There is one thing however, I
need to be able to add some text at the top of the e-mail. Oh and is it
possible to add an auto signature to the mail as well?


Ron de Bruin wrote:
Hi spences10

Try this
http://www.rondebruin.nl/mail/folder3/mail2.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spences10" wrote in message ups.com...
Hi,

I am trying to Copy the contents of an Excel worksheet into an Outlook
mail item, like a simple copy and paste.

Is there any code that can do this, I have examples that can populate
from the worksheet but I need it to be in a table format.

Can anyone help??




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code - Pasting Pictures from Excel into Word Cush Excel Programming 1 October 26th 06 01:06 AM
Pasting Text from Outlook into 1 Excel cell giantwolf Excel Discussion (Misc queries) 3 September 29th 05 01:56 PM
How can I use Outlook express to send mail rather than Outlook by VBA code new.microsoft.com Excel Programming 5 August 3rd 05 03:45 PM
How can I use Outlook express to send mail rather than Outlook by VBA code new.microsoft.com Excel Programming 1 August 1st 05 12:45 PM
Excel Macro code help - re pasting rows bjmccready[_2_] Excel Programming 2 June 24th 04 01:10 PM


All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"