+ Reply to Thread
Results 1 to 4 of 4

VBA to Split data into several reports and email via outlook

  1. #1
    Registered User
    Join Date
    01-15-2009
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2003
    Posts
    3

    VBA to Split data into several reports and email via outlook

    Hello VBA Expers and novices, and everyone in between

    Six months ago I startet looking into VBA, and this forum basically taught me all I know of VBA
    I have always been able to find answers here.. However here is my first post on a problem I can’t solve on my own or seem to read the answer to.

    Here is the case:

    I am extracting data from a excel file and then I am arranging the data in my own excel file. My own excel file contains “contracts” - each line in this sheet contains a contract. Within the line I have all the information needed. I want to create several reports with contracts - they have to be split depending on who owns the contract. The contract owner is defined within each line of the data. The “contract owner” can have multiple contracts so I need to sort the reports so that each "contract owner" only gets 1 email with and attachment with 1 excel file with all his contracts.

    So basically I want to split my excel file into several reports depending on a certain criteria (cell value = contract owner).

    And… I basically created a code that does all this for me.. however I need to tweak the code.
    This is important, as you can see in my code, it is long and depending on the names within the VBA code are correct.
    (Right now i have 46 owners and 250 contracts, so i would have to doublicate the code below 46 times!!).
    Further I am possiblely not the one to maintain the VBA code - so when contract owners change (promted/hired/fired) the code needs to be update manually.. which is a huge pitfall. (or impossible with the code in its current form).

    This is were you come in! There are so many experts out there, I am sure one of you can crack this case – and enlighten me

    Please Login or Register  to view this content.
    Hope to see some inputs - thank you in advace. Peace out!

    (Before you suggest I put this into Access I have to add that I know nothing of Access and my department insists to keep our database as an excel-sheet until a proper contract management system is in place)

    //Skjoldborg
    VBA student
    Attached Files Attached Files
    Last edited by Skjoldborg; 07-06-2009 at 07:32 AM.

  2. #2
    Registered User
    Join Date
    01-15-2009
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: VBA to Split data into several reports and email via outlook

    Problem solved at this tread:

    http://www.mrexcel.com/forum/showthr...94#post1991594

    I have attached solution. Explanation is given in above link.

    2 modules in attached workbook:
    Hardcode = old code
    Smartcode = new code

    Smartcode is the solution i chose that works

    credit to http://www.rondebruin.nl/sendmail.htm
    (where i found the solution)
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-24-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    1

    Re: VBA to Split data into several reports and email via outlook

    I am unable to open the downloaded file as it is reported to be corrupt. Please send at my given mail address.

    Thanks

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: VBA to Split data into several reports and email via outlook

    Hi and welcome
    I downloaded and opened the file without problems. You should check your Office installation or repair it.
    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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