+ Reply to Thread
Results 1 to 7 of 7

A macro to copy a worksheet to a new workbook and create an email draft with the new ws

  1. #1
    Forum Contributor
    Join Date
    04-28-2004
    Location
    Tokyo
    MS-Off Ver
    Office 2016 pro plus
    Posts
    175

    A macro to copy a worksheet to a new workbook and create an email draft with the new ws

    I have a workbook with several tabs. Since there is no way to email only one worksheet from a workbook, I am trying to create a macro that will copy the worksheet "DV Only" from workbook "Yokota Leadership with Spouses" and I then want it to attach the new "DV Only" spreadsheet to outlook with the subject header "DV Info".

    Not sure if this is possible, but thank you for your help. I'm very inexperienced in VBA so I'm hoping I can record it with macro, if not, I'll give it a shot.

    Thank you

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: A macro to copy a worksheet to a new workbook and create an email draft with the new w

    The below should help get you started. I've added a few comments to explain some of it but feel free to ask questions.
    It uses Outlook to send the email. You will need to amend it if that's not the case for you.
    Please Login or Register  to view this content.
    BSB

  3. #3
    Forum Contributor
    Join Date
    04-28-2004
    Location
    Tokyo
    MS-Off Ver
    Office 2016 pro plus
    Posts
    175

    Re: A macro to copy a worksheet to a new workbook and create an email draft with the new w

    I am getting a Compile error. This is what I put in my VBA.

    VBA error.jpg

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: A macro to copy a worksheet to a new workbook and create an email draft with the new w

    You have to add Outlook reference to the tools in your VBA
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: A macro to copy a worksheet to a new workbook and create an email draft with the new w

    Quote Originally Posted by Keebellah View Post
    You have to add Outlook reference to the tools in your VBA
    Not quite. The code is 'late binding' and therefore needs no reference to be added.

    The problem is you're missing a vital part of the code.
    The first line should read:
    Please Login or Register  to view this content.
    BSB

  6. #6
    Forum Contributor
    Join Date
    04-28-2004
    Location
    Tokyo
    MS-Off Ver
    Office 2016 pro plus
    Posts
    175

    Re: A macro to copy a worksheet to a new workbook and create an email draft with the new w

    Thank you for the excellent response, that solved it. I may have another question coming up, I want a VBA to do the same thing, but I want it to add all the email addresses on worksheet "DV Emails" Column B2-B90. If Column A=DV then I want the email address in the TO: box, if A2=DVS I want the email address in CC: Let me know if I need to close this and open a new topic.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: A macro to copy a worksheet to a new workbook and create an email draft with the new w

    My suggestion is to close this one and open a new topic.
    Have you already tried editing your own code to do what you want?
    Trial and error is the way to learn.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create Macro to copy worksheet into new workbook, change things& drop into Outlook
    By sspatriots in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2017, 09:17 AM
  2. Macro to automatically draft email and save in a Folder
    By Mr.India in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2015, 12:16 PM
  3. Macro to send saved draft email from outlook in HTML format
    By jamesshakedown in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-18-2013, 07:55 AM
  4. Macro to Mail Merge individual PDF docs as attachments to email saved in draft box
    By cstockley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2013, 08:33 AM
  5. Create Worksheet/Workbook and email through Macro
    By Amarjeet Singh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2013, 08:41 AM
  6. Copy data from excel to Outlook new email and create draft.
    By G.Bregvadze in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2013, 03:31 AM
  7. Create Lotus Notes Draft email from filtered or unfiltered List
    By Jimmy0306 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-07-2009, 09:03 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1