Hello OpenOffice developers,

I am working on automating OpenOffice with Microsoft Visual Basic 2005 Express.
I use Windows XP SP2 Home and OpenOffice 2.2.0
OpenOffice has QuickStarter NOT activated.

This little routine uses COM Automation to open a new Writer document, close it, and close OpenOffice.

Private Sub demoR6025()
    Dim OOo, desktop, aDoc, aText, aCursor As Object
    Dim noOpts(-1)
    OOo = CreateObject("com.sun.star.ServiceManager")
    desktop = OOo.createInstance("com.sun.star.frame.Desktop")
aDoc = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, noOpts)
    aText = aDoc.getText()
    aCursor = aText.createTextCursor()  ' <--- here is the problem
    MsgBox("document will close now")
    aCursor = Nothing
    aText = Nothing
    aDoc.close(True)
    aDoc = Nothing
    OOo = Nothing
    desktop.terminate()
    desktop = Nothing
    MsgBox("Finished")
End Sub

When I run this routine it works as expected, but I get an error message from the underlying Microsoft Visual C++ Runtime library :
   R6025 - pure virtual function call
This happens as a result of desktop.terminate()
Despite the error, the routine finishes and OpenOffice terminates.

But if I comment out the line which creates the TextCursor, the same routine works OK without error message. So I think that OpenOffice is guilty, not Microsoft.

This error is very annoying : it is not possible to catch the exception and ignore it, because it is raised by an independent process (C++ Runtime).

Should I create an Issue ?

Bernard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to