Im a beginner programmer and completely new here.
Ive got a simple application which inserts some text in MS WORD. This
application was developed in Visual Basic Express 2005, the only language Ive
learned so far (and not so well).
However, I urgently need a way to insert these texts in Openoffice Writer as
the use of MS Word is being banished from my environment work.
Ive been trying to use the following code provided in the Openoffice site:
Dim objServiceManager As Object
objServiceManager = CreateObject("com.sun.star.ServiceManager")
Dim objDesktop As Object
objDesktop=objServiceManager.createInstance("com.sun.star.frame.Desktop")
Dim objDocument As Object
Dim args()
objDocument =
objDesktop.loadComponentFromURL("private:factory/swriter","_blank", 0, args)
Dim objText, objCursor As Object
objText = objDocument.getText
objCursor = objText.createTextCursor
objText.insertString(objCursor, "The first line in the newly created text
document." & vbLf, False)
However, its not working. When I debug it, the objDocument remains equals to
NOTHING.
Is it necessary to add any reference?
How is it possible to assign objDocument with the current document in Writer?
Could someone please help me?
Greetings,
Alessandro
---------------------------------
Yahoo! Acesso Grátis
Internet rápida e grátis. Instale o discador agora!