Consulting

Results 1 to 5 of 5

Thread: Emailing workbook with message

  1. #1
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location

    Emailing workbook with message

    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
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    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.

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

    HTH,
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  3. #3
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Check out this KB Entry.
    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.

  4. #4
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    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.

    And a Happy New Year to you both.


    PS I see you got a promotion Jacob, much deserved - MANY CONGRATS!!!
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  5. #5
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Thanks

    And Happy New Year

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •