![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 17
|
I’m using Excel 2000 and would like to sent one sheet only. I found this code (for Excel 2002) when searching but I get an error message on the 3rd line. This is exactly what I need. Can you help this novice? Thanks.
sheets("sheet1").copy activeworkbook.sendmail recipients:="email_address@hotmail.com", Subject:="Testing" |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
Hi Bob,
This code will work fine in Excel 2000 but you need to include the Recipients:= bit on the same line as the ActiveWorkbook.SendMail i.e. Sheets("sheet1").Copy ActiveWorkbook.SendMail Recipients:="email_address@hotmail.com", Subject:="Testing" Recipients and Subject are arguments of the SendMail method. HTH, Dan |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Greenwood, SC
Posts: 677
|
I copied the code and got it to work. I do know that the 3rd line should be a continuation of the 2nd line (i.e. there should be no 3rd line). Not sure if this is how you intended to post it, or if is just a function of this message board system.
K |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Cape Town,South Africa
Posts: 234
|
Hi there friend
maybe you should try this code Sub anothermailAP() Dim filenam As String Dim ol As Object Dim mailitem As Object Dim Subj As String Dim Month As String filenam = Application.ActiveWorkbook.FullName Set ol = CreateObject("Outlook.Application") Set mailitem = ol.CreateItem(olMailItem) ' Gets the name of the e-mail recipient. Recip = "" ' Creates the subject line. Month = Cells(5, 2) Subj = Month & "" ' Creates the e-mail message text. messg = "Attached are the worksheet you requested for " & Month & "." & vbCrLf & vbCrLf & _ "Please review them and let me know about any changes that are made." ' Sets all items in the e-mail. With mailitem .To = Recip .Subject = Subj .Body = messg .Attachments.Add filenam .Display End With End Sub Try This,,it send a whole worksheet away to recipient. |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Posts: 113
|
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Apr 2002
Posts: 8
|
Can I send it to Outlook Express instead of Outlook? What do I change in " createobject("Outlook.Application") " ?
I was looking for the Outlook Express Object Model in MSDN but no luck. Anybody know where I can find it? Thanks |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
In fact I don't beleive the Coms is exposed for manipulation. Is OE your default emailer ?? If not then try resetting your default mail prg in Internet setup to OE. Thanks _________________ Kind Regards, Ivan F Moala [ This Message was edited by: Ivan F Moala on 2002-05-14 01:36 ] |
|
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
Quote:
Unfortunately Outlook Express is not an automation server and as such doesn't expose an object model. You won't be able to use code for OE in the same way you can for Outlook. There are samples around for automatically sending mail from OE but I don't think they're as reliable or as neat as code you can create with Outlook - e.g. I think they all rely on the Sendkeys method to actually send the message. Regards, Dan |
|
|
|
|
|
|
#9 | ||
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
on some sought of Send Keys... |
||
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|