I am running 64bit Illustrator version 16.0.3 on Windows 7 and when I try to run the following code in VB.Net 2010 I get
Creating an instance of the COM component with CLSID {B9D4209B-1A9A-40FF-8ABD-2636E7987BF5} from the IClassFactory failed due to the following error: 80010105 The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)).
It seems that once the oIllustrator object is instantiated the application has not yet loaded completely as the menu in Illustrator has yet to appear and so any of the code in red will fail with a COM exception.
The only way I can avoid the COM exception is by adding a thread.sleep. EIther this is a bug or there must be a better way of doing this.
Of course if Illustrator is already loaded then rerunning the code is not a problem only when Illustrator isn't running and it has to load then this becomes a problem.
Originally I used CreateObject but I still had the problem.
Dim oIllustrator As New Illustrator.Application
Dim oEPS As Illustrator.Document
Dim oTextFrame As Illustrator.TextFrame
Dim oTextRange As Illustrator.TextRange
Dim xPath As String = "\\dfs\Graphics\Images\"
'Threading.Thread.Sleep(1000) 'Prevents COM Exception error 80010105 by allowing Illustrator more time to fully load
Dim oEPSSaveOptions As New Illustrator.EPSSaveOptions
oIllustrator.Application.UserInteractionLevel = Illustrator.AiUserInteractionLevel.aiDontDisplayAlerts
oEPS = oIllustrator.Open(xPath + "test.eps")