+ Reply to Thread
Results 1 to 9 of 9

VBA code to copy data from current workbook to another workbook and send email

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    VBA code to copy data from current workbook to another workbook and send email

    Hi Guys

    I have written the code that copies data across Sheet1 of current workbook.

    Now the next step is to store data from sheet1 of Thisworkbook to another workbook named TemplateWB and send that as an attachment in the email. The another workbook name "TemplateWB" is stored in the following folder: "C:\abc\templates"

    Can anyone please help me in the VbA code?

    Thanks

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: VBA code to copy data from current workbook to another workbook and send email

    Hi,
    Do you want the data to be appended into a sheet that is already present in TemplateWB or inserted as a new sheet ?
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: VBA code to copy data from current workbook to another workbook and send email

    No there won't be any data already present in TemplateWB. So the data will be inserted in Sheet1 of TemplateWB and later on the sheet1 will be cleared after being sent as an email.

  4. #4
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: VBA code to copy data from current workbook to another workbook and send email

    this is the copy part :

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: VBA code to copy data from current workbook to another workbook and send email

    Thanks xlbiznes. It worked. Actually TemplateWB has extension .xls.

    Now next bit is my manager wants me to store data from Activesheet to a copy of TemplateWB. So everytime when the data needs to be copied then it should be copied in the copy of TemplateWB and then that copy should be sent as an attachment in the email. Any help would be much appreciated.

    Thanks

  6. #6
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: VBA code to copy data from current workbook to another workbook and send email

    Can anyone please help me in this? Thanks

  7. #7
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: VBA code to copy data from current workbook to another workbook and send email

    This is what i have understood :


    a) copy the activesheet into the template file in C:\abc\templates\templatewb.xls
    b) Make a copy of this file
    c) Send it as an email

    What mail client are you using to send the email and where are the email id's ?

  8. #8
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: VBA code to copy data from current workbook to another workbook and send email

    Ok. There is a combobox with all the email addresses in the userform. so the user will select any of the email addresses and then press button. And on the click event of that button , the code will run and all the above steps will be performed. Thanks

  9. #9
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: VBA code to copy data from current workbook to another workbook and send email

    And also the steps are below:

    1. Cope the data from Activesheet and paste the data in a copy of Template file.
    2. Then send that copy as an email

    SO we will be storing data in the copy of template file so we are not going to mess aroung with the actual master file. Thanks

+ 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. VBA code for copy data from closed workbook to "Data " sheet of current workbook
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-13-2014, 02:23 AM
  2. Replies: 1
    Last Post: 03-11-2014, 12:44 PM
  3. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  4. Send an email listing cell data when workbook is modified.
    By vbchallenged in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2013, 03:51 PM
  5. VBA code to copy data from specific worksheets from current workbook to a new one
    By Uday2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2013, 12:15 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