Alessandro Tristão wrote:
I’m a beginner programmer and completely new here.
  I’ve got a simple application which inserts some text in MS WORD. This 
application was developed in Visual Basic Express 2005, the only language I’ve 
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.
  I’ve 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, it’s 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?
It's been quite a while since I did any programming in OOBasic ( and I hope it's quite a while before I have to again ). Your best bet is to check out: http://www.oooforum.org/ - that's where I go when I have to figure out OOBasic stuff.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

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

Reply via email to