I have a macro that, using a For Each...Next loop, cycles through each of the "first level" folders beneath the "personal folder" and, if it is (a) a folder for mail and (b) is not one of the standard folders (eg deleted items, sent items etc), adds the name of the folder to a one-dimensional array.
All pretty straightforward. However, the first time I run this macro after turning my pc on, it takes 11.5 seconds to do this. There seems to be a lot of hard disk activity during this time. If I run the macro again, it only takes 0.2 seconds (even if I have closed and re-opened Outlook in the meanwhile). There are only about 40 folders it has to cycle through, of which 27 are loaded into the array.
I would really like to speed this process up for that first time after switching on the pc. Can anyone explain why it takes so long and what I might do about it? Could I have Outlook automatically do something in the background on opening such that, by the time I want to run my macro (which is likely to be several minutes up to several hours after opening Outlook), it will only take the 0.2 seconds? Or can I store the folder list somehow?
Thanks for any ideas