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??




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

Hi Ron,

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??




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

I have already tried this and no joy.

I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??





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

Hi Ron,

i have amended the code as directed [please see below] and it still
only pasts the defined area and does not add the text as a string. :-(

Function TLMailDiscretionRequest()
' 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." &
"<br<br"

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = StrBody & 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 Function


Ron de Bruin wrote:
I have already tried this and no joy.


I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??





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

Which Excel version do you use ?
Can you send me the workbook private.


--

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


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

i have amended the code as directed [please see below] and it still
only pasts the defined area and does not add the text as a string. :-(

Function TLMailDiscretionRequest()
' 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." &
"<br<br"

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = StrBody & 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 Function


Ron de Bruin wrote:
I have already tried this and no joy.


I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??








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

Stupid from me

If Word is your mail editor in Outlook this is not working
Change it in Outlook: ToolsOptions..Mail format tab


--

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


"Ron de Bruin" wrote in message ...
Which Excel version do you use ?
Can you send me the workbook private.


--

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


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

i have amended the code as directed [please see below] and it still
only pasts the defined area and does not add the text as a string. :-(

Function TLMailDiscretionRequest()
' 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." &
"<br<br"

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = StrBody & 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 Function


Ron de Bruin wrote:
I have already tried this and no joy.

I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??






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

thats it Ron,

thank you very much
Ron de Bruin wrote:
Stupid from me

If Word is your mail editor in Outlook this is not working
Change it in Outlook: ToolsOptions..Mail format tab


--

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


"Ron de Bruin" wrote in message ...
Which Excel version do you use ?
Can you send me the workbook private.


--

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


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

i have amended the code as directed [please see below] and it still
only pasts the defined area and does not add the text as a string. :-(

Function TLMailDiscretionRequest()
' 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." &
"<br<br"

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = StrBody & 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 Function


Ron de Bruin wrote:
I have already tried this and no joy.

I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??







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

Hi Ron,

Last question [I think], now that I can send both the pasted area from
excel and some text. is there any way I can ensure that this happens
for other users, or will they all have to change their Outlook settings
as I have?


spences10 wrote:
thats it Ron,

thank you very much
Ron de Bruin wrote:
Stupid from me

If Word is your mail editor in Outlook this is not working
Change it in Outlook: ToolsOptions..Mail format tab


--

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


"Ron de Bruin" wrote in message ...
Which Excel version do you use ?
Can you send me the workbook private.


--

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


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

i have amended the code as directed [please see below] and it still
only pasts the defined area and does not add the text as a string. :-(

Function TLMailDiscretionRequest()
' 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." &
"<br<br"

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = StrBody & 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 Function


Ron de Bruin wrote:
I have already tried this and no joy.

I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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??







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

or will they all have to change their Outlook settings
Yes.

If you can change this setting (if possible with code, I never try) and users
like the Word interface to edit mail then I don't think they want you to change this setting.


--

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


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

Last question [I think], now that I can send both the pasted area from
excel and some text. is there any way I can ensure that this happens
for other users, or will they all have to change their Outlook settings
as I have?


spences10 wrote:
thats it Ron,

thank you very much
Ron de Bruin wrote:
Stupid from me

If Word is your mail editor in Outlook this is not working
Change it in Outlook: ToolsOptions..Mail format tab


--

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


"Ron de Bruin" wrote in message ...
Which Excel version do you use ?
Can you send me the workbook private.


--

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


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

i have amended the code as directed [please see below] and it still
only pasts the defined area and does not add the text as a string. :-(

Function TLMailDiscretionRequest()
' 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." &
"<br<br"

On Error Resume Next
With OutMail
.To = "Dolder, Colin : Business Banking Risk"
.CC = ""
.BCC = ""
.Subject = "DISCRETION REQUEST"
.HTMLBody = StrBody & 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 Function


Ron de Bruin wrote:
I have already tried this and no joy.

I not see that in your code
Note: I not use vbnewline and the HTMLBody line is different



--

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


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

I have already tried this and no joy.

Confused = (

Ron de Bruin wrote:
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 04:52 AM.

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

About Us

"It's about Microsoft Excel"