To save other's time, while trying this out I got an error, solved (Ithink) by changing'ForAppending = 3' to 'ForAppending = 8'(This is microsoft's own example which it seems they've got wrong)