PDA

View Full Version : [SOLVED] Emailing workbook with message



johnske
01-02-2005, 12:38 AM
Hi,

I have a main Excel workbook that I want to copy a sheet from and put in a new book - deleting the other 2 sheets in the new book.

That's pretty straight-forward, no help needed there...

But now I want to run a procedure in the main book that basically runs when the user clicks "submit by email" (the email address will be in a cell in the main book).

The procedure then has to send an email with a set message such as "submission for..(someone) dated..(a date) , but I also want this new (one worksheet) book sent as an attachment to the email.

I know absolutely NOTHING about Outlook - I had a look, but couldn't see any way to manually record a macro to do this - but anyway, I dont know if the end-user(s) normally use Outlook, Outlook Express, or whatever to send anyway...

So - where do I start???

TIA

Ken Puls
01-02-2005, 12:46 AM
Hi Johnske, Happy New Year!

Do you need a record in your sent mail? If not, you could try Ron de Bruin's CDO alternative to SendMail


The example code is using CDOSYS (CDO for Windows 2000). It does not depend on MAPI or CDO and hence is dialog free and does not use your mailbox to send email.
The full description of the how and such is found here (http://www.rondebruin.nl/cdo.htm).

I've used it before, as I can send a file to home/work without actually having to code for two different systems.

HTH,

Jacob Hilderbrand
01-02-2005, 12:52 AM
Check out this KB Entry (http://www.vbaexpress.com/kb/getarticle.php?kb_id=97).
Once you save the workbook just put that path/name in for the .Attachment, for .To you can put the cell reference with the email address.

johnske
01-02-2005, 01:01 AM
Thanx Ken, Jacob,

Haven't tried either of these yet, but you've both given me something to get started with... I'm sure I can get something working now. :yes

And a Happy New Year to you both.


PS I see you got a promotion Jacob, much deserved - MANY CONGRATS!!!

Jacob Hilderbrand
01-02-2005, 01:18 AM
Thanks

And Happy New Year :drunkard: