Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Send Attachment (previous one got away)


I'm using a code from the Walkenbach book to send a single sheet from
a workbook in an email:

Sub SendOneSheet()
Dim Filename As String
Filename = "my file.xls"
ActiveWorkbook.Worksheets("sheet1").Copy

To this point everything makes sense to me. Then...

ActiveWorkbook.SaveAs Filename <--- How does this step know to
save the copied "sheet1" and save that as Filename?

ActiveWorkbook.Sendmail ", "My Sheet" <---
Here, what tells it to attach the saved file to the email?

ActiveWorkbook.Close False
Kill Filename
End Sub

Got the rest. Another twist I'd like to use would be to copy the
"sheet1" and PasteSpecial Values so that all formulas are eliminated,
leaving just the result of the formula at the time of the code being
run...

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Send Attachment (previous one got away)

Try copying a sheet from an existing workbook manually. You'll see that the
activesheet becomes the newly copied sheet. Same with the activeworkbook.

After the .copy line

with activesheet.cells
.value = .value
end with

or
with activesheet.cells
.copy
.pastespecial paste:=xlpastevalues
end with




MLT wrote:

I'm using a code from the Walkenbach book to send a single sheet from
a workbook in an email:

Sub SendOneSheet()
Dim Filename As String
Filename = "my file.xls"
ActiveWorkbook.Worksheets("sheet1").Copy

To this point everything makes sense to me. Then...

ActiveWorkbook.SaveAs Filename <--- How does this step know to
save the copied "sheet1" and save that as Filename?

ActiveWorkbook.Sendmail ", "My Sheet" <---
Here, what tells it to attach the saved file to the email?

ActiveWorkbook.Close False
Kill Filename
End Sub

Got the rest. Another twist I'd like to use would be to copy the
"sheet1" and PasteSpecial Values so that all formulas are eliminated,
leaving just the result of the formula at the time of the code being
run...

Thanks for any help.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Send Attachment (previous one got away)

See also
http://www.rondebruin.nl/mail/folder1/mail2.htm

--

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


"MLT" wrote in message ...

I'm using a code from the Walkenbach book to send a single sheet from
a workbook in an email:

Sub SendOneSheet()
Dim Filename As String
Filename = "my file.xls"
ActiveWorkbook.Worksheets("sheet1").Copy

To this point everything makes sense to me. Then...

ActiveWorkbook.SaveAs Filename <--- How does this step know to
save the copied "sheet1" and save that as Filename?

ActiveWorkbook.Sendmail ", "My Sheet" <---
Here, what tells it to attach the saved file to the email?

ActiveWorkbook.Close False
Kill Filename
End Sub

Got the rest. Another twist I'd like to use would be to copy the
"sheet1" and PasteSpecial Values so that all formulas are eliminated,
leaving just the result of the formula at the time of the code being
run...

Thanks for any help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Send Attachment (previous one got away)

I'm using a script written by Ron Debruin to send an email with an
attachment. I'm not sure its necessary to repost that code here but
I'm trying to figure out what part of the code actually sends the
email. What I'd like to do is cut the code just short of sending the
message so that the user can add text to the body of the message, then
send it when ready. Help?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Send Attachment (previous one got away)

Hi MLT

If you use the Outlook object model code from my site you
can change .Send to .Display

If you use the code from the first section of my mail page
the only way is to leave the To string empty

Choose a address in the address book of your mail program.
When you use "" you can choose a mail address in your address book.

.SendMail "", "This is the Subject line"


--

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




"MLT" wrote in message ...
I'm using a script written by Ron Debruin to send an email with an
attachment. I'm not sure its necessary to repost that code here but
I'm trying to figure out what part of the code actually sends the
email. What I'd like to do is cut the code just short of sending the
message so that the user can add text to the body of the message, then
send it when ready. Help?



__________ Information from ESET Smart Security, version of virus signature database 3943 (20090317) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 3943 (20090317) __________

The message was checked by ESET Smart Security.

http://www.eset.com





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Send Attachment (previous one got away)

Duh, it was right there in the commenting. That works perfectly,
thanks!
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Send Attachment (previous one got away)

You are welcome

--

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




"MLT" wrote in message ...
Duh, it was right there in the commenting. That works perfectly,
thanks!

__________ Information from ESET Smart Security, version of virus signature database 3943 (20090317) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 3943 (20090317) __________

The message was checked by ESET Smart Security.

http://www.eset.com



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
Send As PDF Attachment SnackBar Excel Discussion (Misc queries) 6 November 24th 07 09:40 AM
Help to Send as attachment. Pools New Users to Excel 7 July 2nd 06 03:03 AM
Send as Attachment [email protected] Excel Discussion (Misc queries) 0 June 7th 06 06:50 PM
My send to in excel/word does not offer send as attachment Mstink Excel Discussion (Misc queries) 11 March 16th 06 02:49 PM
send as attachment confused in NC Excel Discussion (Misc queries) 1 July 19th 05 06:02 PM


All times are GMT +1. The time now is 07:21 PM.

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"