The Project Professional 2007 TimeScaleValue object can result in a COM exception, or other crash, if used several times in quick succession. Reference to this method can be found at http://msdn.microsoft.com/en-us/library/aa195549(office.11).aspx.
The error may be:
AutomationException: 0x800a03ec – An unexpected error occurred with the method – but depending where you are using the methodand which language you are using you will get different wording and HEX code.
Calling the TimeScaleData method returns a TimeScaleValues collection containing TimeScaleValue items. When iterating through the returned list in C#, VB.NET or VBA and accessing the Value member of each item, a COM Exception can occur on or about the 10th returned value. This is particularly noticeable in any form of loop that quickly iterates through the values.
In order to work around this issue, you can call the .NET method GC.Collect, or to ‘reset’ the condition that can lead to the error. Simply insert the garbage collection method in the loop so it runs on the 8th or 9th iteration, and the error should not occur, and the workaround shouldn’t cause noticeable performance issues.
This article covers use of the GC.Collect method – http://msdn.microsoft.com/en-us/library/system.gc.collect.aspx
** Update** – Had a quick response from Colby Africa who posted another workaround option at http://colbyafrica.blogspot.com/2010/12/microsoft-project-timescaledata-method.html. A very novel approach!