Posts by corbo152

    Re: Exporting Email Body Text to excel (using outlook 2010) VBA


    Hi cytop,


    Is the above code to be pasted in the same Thisoutlooksession?, above or below the existing sub for the data export?


    the attachments will all go into one folder. and list by date modified so that the data exported and attachments will match up to each other in order


    Thanks

    Re: Exporting Email Body Text to excel (using outlook 2010) VBA


    Thanks,


    This now works and data is all stacking up nicely :)


    From looking through the data i have noticed that sometimes there are 5 lines of text instead of 4 so for example:


    Name, Address 1, Address 2, Address 3, Postcode
    Name, Address 1, Address 2, Postcode
    Name, Address 1, Address 2, Address 3, Postcode
    Name, Address 1, Address 2, Postcode


    As the data will always sit under the headings i need to tell the code to parse address 3 if it is present otherwise print a blank space and still put postcode in the 5th box

    Re: Exporting Email Body Text to excel (using outlook 2010) VBA


    Quote from cytop;682280

    Should do - why don't you try it?


    Create a draft message. Save it and then drag from the Drafts folder to the BG folder.


    Don't forget you have to close Outlook after editing the code and restart it. You will be prompted to enable macros, same as in Excel.


    I can confirm that the text is outputting to a CSV file ok.


    the only thing i have noticed is that every time an email is received the original data exported is overwritten and not put on a seperate line and saved to the same CSV.


    Is there any way to do it so that:


    Name,Address 1, Address 2, Postcode
    Name,Address 1, Address 2, Postcode
    Name,Address 1, Address 2, Postcode
    Name,Address 1, Address 2, Postcode



    Thanks again for all your help

    Re: Exporting Email Body Text to excel (using outlook 2010) VBA


    Many Thanks cytop,


    I have added the code into the ThisOutLook session module and saved it.


    I have renamed and created the appropriate CSV file in the correct directory,


    so i take it this script will run when an email is recieved in the british gas subfolder?

    Re: Exporting Email Body Text to excel (using outlook 2010) VBA


    Quote from cytop;682270

    If there are only those 4 lines of text, and all the text is to be exported, then fine. If there's other text, you need to upload a sample of the email body.


    Hi cytop,


    Yes there are only those 4 lines of text to be exported. no other text in the emails at all.

    Re: Exporting Email Body Text to excel (using outlook 2010) VBA


    Hi Cytop,


    First of all many thanks for your reply. i have been away on holiday so only just got chance to look at this.


    The full details of what i require are:


    Emails will always be moved by Outlook into a folder named British Gas


    the text i require to be outputted will always be in the same format:


    There will be 4 lines of text to be exported.

    Name
    Address 1
    Address 2
    Postcode

    these will ideally need to be exported to a .CSV file with comma seperated fields so that our printer can run them through label matrix


    Again many thanks for your help

    Hi,


    I am wanting to extract some text form the body of emails that come in daily,


    The emails are always in the same format which is:


    Name
    Address 1
    Address 2
    Address 3
    Postcode

    These fields will need to be extracted to an Excel document under the relevant field headers,


    I have done some programming before but not had any experience with VBA,


    Thanks