Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Emailing range in message body using VBA - problem

I used Article ID: 816644 and copied and pasted to set up in a macro. I get
error message 430 - Class does not support automation or does not support
expected interface. The code

Sub mail1()
Dim CSR As String
Set Location = Worksheets("CSRs").Range("Schedules")
CSR = Application.WorksheetFunction.Index(Location, 1, 7)
ActiveSheet.Range("rpt01").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = CSR
.Item.Subject = "Daily Report"
.Item.Send
End With
End Sub

With other programming I was able to send the whole worksheet as an
attachment in an email. I was also able to send the range in the message
body using SendKeys but that gave erratic results.

I just can't seem to send a range as the message body using VBA without
SendKeys. Suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Emailing range in message body using VBA - problem

Are you getting the error while referring the range directly instead of using
the named ranges.

If this post helps click Yes
---------------
Jacob Skaria


"Steve" wrote:

I used Article ID: 816644 and copied and pasted to set up in a macro. I get
error message 430 - Class does not support automation or does not support
expected interface. The code

Sub mail1()
Dim CSR As String
Set Location = Worksheets("CSRs").Range("Schedules")
CSR = Application.WorksheetFunction.Index(Location, 1, 7)
ActiveSheet.Range("rpt01").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = CSR
.Item.Subject = "Daily Report"
.Item.Send
End With
End Sub

With other programming I was able to send the whole worksheet as an
attachment in an email. I was also able to send the range in the message
body using SendKeys but that gave erratic results.

I just can't seem to send a range as the message body using VBA without
SendKeys. Suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Emailing range in message body using VBA - problem

Hi Steve

Is your Outlook version the same as your other Office programs ?

You can use this also

Mail worksheet in the body
http://www.rondebruin.nl/mail/folder3/mail2.htm

Mail Range or Selection in the body
http://www.rondebruin.nl/mail/folder3/mail4.htm


Seee also my Envelope page
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

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




"Steve" wrote in message ...
I used Article ID: 816644 and copied and pasted to set up in a macro. I get
error message 430 - Class does not support automation or does not support
expected interface. The code

Sub mail1()
Dim CSR As String
Set Location = Worksheets("CSRs").Range("Schedules")
CSR = Application.WorksheetFunction.Index(Location, 1, 7)
ActiveSheet.Range("rpt01").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = CSR
.Item.Subject = "Daily Report"
.Item.Send
End With
End Sub

With other programming I was able to send the whole worksheet as an
attachment in an email. I was also able to send the range in the message
body using SendKeys but that gave erratic results.

I just can't seem to send a range as the message body using VBA without
SendKeys. Suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Emailing range in message body using VBA - problem

Ron,

I copied/adapted your "mail selection in the body" code, using another
subroutine to preset the range and pass the email address to your subroutine.
I worked great. You probably got an email from an interim adaptation I
tried before I realized your email address was in there by default.

One problem At work we normally have Outlook open all the time. Your
programming puts the focus on Outlook over Excel and sends the email after
you acknowledge the confirmation box. But then Outlook stays on top. We
need it to at least go back to to the worksheet location, and ideally never
shift the focus away from Excel except for the acknowledgment box that pops
up.

Please advise. We use Office 2003.

Thanks,

Steve


"Ron de Bruin" wrote:

Hi Steve

Is your Outlook version the same as your other Office programs ?

You can use this also

Mail worksheet in the body
http://www.rondebruin.nl/mail/folder3/mail2.htm

Mail Range or Selection in the body
http://www.rondebruin.nl/mail/folder3/mail4.htm


Seee also my Envelope page
http://www.rondebruin.nl/mail/folder3/mailenvelope.htm

--

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




"Steve" wrote in message ...
I used Article ID: 816644 and copied and pasted to set up in a macro. I get
error message 430 - Class does not support automation or does not support
expected interface. The code

Sub mail1()
Dim CSR As String
Set Location = Worksheets("CSRs").Range("Schedules")
CSR = Application.WorksheetFunction.Index(Location, 1, 7)
ActiveSheet.Range("rpt01").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = CSR
.Item.Subject = "Daily Report"
.Item.Send
End With
End Sub

With other programming I was able to send the whole worksheet as an
attachment in an email. I was also able to send the range in the message
body using SendKeys but that gave erratic results.

I just can't seem to send a range as the message body using VBA without
SendKeys. Suggestions?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Emailing range in message body using VBA - problem

Based on buttons, I have about 20 small macros that select a particular named
range ("rpt01" in the example below) and select the appropriate email address.

If a long subroutine is required (such as Ron de Bruin's, another responder)
I would use the small macro to preset the named range and pass the email
address to the long subroutine.

We use Office 2003 and normally have email open all day.

Thanks,

Steve

"Jacob Skaria" wrote:

Are you getting the error while referring the range directly instead of using
the named ranges.

If this post helps click Yes
---------------
Jacob Skaria


"Steve" wrote:

I used Article ID: 816644 and copied and pasted to set up in a macro. I get
error message 430 - Class does not support automation or does not support
expected interface. The code

Sub mail1()
Dim CSR As String
Set Location = Worksheets("CSRs").Range("Schedules")
CSR = Application.WorksheetFunction.Index(Location, 1, 7)
ActiveSheet.Range("rpt01").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = CSR
.Item.Subject = "Daily Report"
.Item.Send
End With
End Sub

With other programming I was able to send the whole worksheet as an
attachment in an email. I was also able to send the range in the message
body using SendKeys but that gave erratic results.

I just can't seem to send a range as the message body using VBA without
SendKeys. Suggestions?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Emailing range in message body using VBA - problem

Based on buttons, I have about 20 small macros that select a particular named
range ("rpt01" in the example below) and select the appropriate email address.

If a long subroutine is required (such as Ron de Bruin's, another responder)
I would use the small macro to preset the named range and pass the email
address to the long subroutine.

We use Office 2003 and normally have email open all day.

Thanks,

Steve

"Jacob Skaria" wrote:

Are you getting the error while referring the range directly instead of using
the named ranges.

If this post helps click Yes
---------------
Jacob Skaria


"Steve" wrote:

I used Article ID: 816644 and copied and pasted to set up in a macro. I get
error message 430 - Class does not support automation or does not support
expected interface. The code

Sub mail1()
Dim CSR As String
Set Location = Worksheets("CSRs").Range("Schedules")
CSR = Application.WorksheetFunction.Index(Location, 1, 7)
ActiveSheet.Range("rpt01").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = CSR
.Item.Subject = "Daily Report"
.Item.Send
End With
End Sub

With other programming I was able to send the whole worksheet as an
attachment in an email. I was also able to send the range in the message
body using SendKeys but that gave erratic results.

I just can't seem to send a range as the message body using VBA without
SendKeys. Suggestions?

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
Emailing a template and keeping same layout as the message body [email protected] Excel Discussion (Misc queries) 0 August 6th 08 10:16 PM
Emailing Range in Body CC Problem Corey Excel Programming 1 March 15th 07 03:15 PM
Emailing range for Excel and adding body text Peter Vaughton Excel Programming 1 November 15th 06 05:39 PM
Code problem emailing range as html in Outlook body Alan Campbell Excel Programming 3 August 25th 04 06:59 PM
Send a range in Excel as the body of an Outlook Express message Katie[_3_] Excel Programming 2 August 14th 04 12:50 PM


All times are GMT +1. The time now is 08:22 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"