#  Other Applications & Softwares  > Outlook Formatting & Functions >  >  Macro for Exporting Outlook Messages to Excel - Split Subject problems

## jbeans

This is my first time working with Macro's in outlook [VBA Newbie] - Any help would be greatly appreciated.

I have a macro that exports Outlook emails to an Excel workbook. The only information I need to export is the subject of the email and the date the email was received.  
I have the code below that exports the subject to my spreadsheet, but i'm not sure how to split the subject line after the first space in the subject to create two items to be placed into different cells. With the code below the whole subject goes into one cell. I tried using the split function to create an array for the subject but I get an 'error 91' with no description when running the Macro. I basically just need to split the subject after the 'case number' (which has no spaces) into two pieces of data - the case number and the comment after the case number, then have these two pieces of data go into different columns in Excel.


All of the subject lines of these emails are formatted the same, for example:





> 123-654321  APPROVED Request Approved Via John




On my spreadsheet I need the case number to go into cell B1 and everything after the case number to go into cell D1 - the have the date in cell C1

like so...

[ Case #  ]                   [ email date           [ status ]
[ XXX-XXXXX ]             [ 1-1-2013  ]          [ CONTINGENT Request made Via John ]
[ XXX-XXXXX ]             [ 1-2-2013  ]          [ APPROVED  Request Approved Via John ]
[ XXX-XXXXX ]             [ 1-3-2013  ]          [ Denied Request Denied Via John ]
[ XXX-XXXXX ]             [ 1-4-2013  ]          [ OtherStatus Message Request status Via John ]



This works, but puts the subject into one column in Excel:





```
Please Login or Register  to view this content.
```




I tried this to split the subject:





```
Please Login or Register  to view this content.
```

----------

