Error opening assembly using api

Has anyone every come across an Automation Error?  I have a program to automate my model generation by way of opening the requried parts and assemblies and dumping the required information into design tables to get all the required information for each part and assembly.  My problem is when the program gets to a part where it must open one of the larger sub-assemblies I get an error message that says "Automation Error:  The server threw an exception".  I click okay and then the program seems to freeze and the assembly I was trying to open is not on the screen.  I try and close SolidWorks and I am asked to save the components of this assembly.  If I click Don't Save the program crashes.  If I click Save the parts are saved and the program closes as it should.  Then if I try and open that same assembly it opens fine and all parts are exactly as they should be.  What can be causing this kind of error?  The errors occurs in the last 1/3 of the program and uses the same code as the rest of the program.  I'm stumped and trying anything to correct this.  Any idea's?

Shawn T.

SolidworksApi macros