Hello, Sir
Is some error exits in the task List bar when you use Edit.FormatDocument to format your code.
I have invested your problem, and please note that the Edit.FormatDocument will not work if there is some errors exits in the taskList window. For it could not identity the code element(variable, class, etc), so it does not now where to put the code element.
If I misunderstood you, feel free to let me know.
Thanks
Chao