Re: VBA code to open specific email and copy the email body to excel and save it.
Heya,
Firstly I assume its now working ?
a) what do you mean by "fix" the font and font size? You can definatley set the font and font size to whatever you like. Currently code is moving the information to columnA, so something like
thisworkbook.sheets(1).columns(1).font.name = "Arial"
thisworkbook.sheets(1).columns(1).font.size = 12
b) yes, currently the reason that it doesn't is each line is set to go to the next blank cell so it is actually putting the blank lines in, it just overwrites them with the next line. to get around this, you need another dim line
and replace the existing "for j" loop with
set rstart = thisworkbook.sheets(1).cells(65000,1).end(xlup).offset(1,0)
For j = 0 To UBound(abody)
'For each item in the array (i.e. each line) add the line to the first empty cell in column A of sheet1
rstart.Offset(j+1, 0).Value = abody(j)
Next
this will find the next blank line at the start of the loop, and then go down one line for each array element.
c) Not....... easily. You can set this macro to run automatically at specific times, but whenever it runs you will get the security warning about another application accessing your emails, which you will have to "OK". because of this, you will need human interaction here to get past this prompt. Although there are ways around this, I can't tell you about them This forum has strict (and in my opinion very worthwhile) rules about assisting people to bypass the security settings in Microsoft products, and this is one of them. Although I'm completely confident your goal is legitimate, this is a public forum, and the same information could easily be used to circumvent security settings in a non-legitimate application.
d) sure, and the end you need something like