At this point I've run in to a wall.
Here's what I do:
objServiceManager = actxserver('com.sun.star.ServiceManager')
objDesktop=invoke(objServiceManager,'createInstance','com.sun.star.frame.Desktop')
objDocument = invoke(objDesktop,'private:factor/swriter','_blank',0,[])
The last line causes an error that's says
??? Invoke Error: Unknown name or named argument
Here's some example VB code that is given as an example at http://udk.openoffice.org/common/man/tutorial/office_automation.html. Supposedly this VB codes creates a writer document and inserts some text.
'The service manager is always the starting point
'If there is no office running then an office is started up
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")
'Create the Desktop
Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Open a new empty writer document
Dim args()
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter",_
"_blank", 0, args)
'Create a text object
Set objText= objDocument.getText
'Create a cursor object
Set objCursor= objText.createTextCursor
'Inserting some Text
objText.insertString objCursor, "The first line in the newly created text document."&_
vbLf, false
If you'll look closely you'll see that you tried to invoke the first argument as the function name, which of course results in an error. Instead:
objDocument = invoke(objDesktop, 'loadComponentFromURL', 'private:factor/swriter','_blank',0,[])
Yair Altman
http://UndocumentedMatlab.com
You're right--I was wondering why the error message was a little different then last time I tried. Thanks for catching that. So with the corrected code:
objServiceManager = actxserver('com.sun.star.ServiceManager')
objDesktop=invoke(objServiceManager,'createInstance','com.sun.star.frame.Desktop')
objDocument=invoke(objDesktop,'loadComponentFromURL','private:factor/swriter','_blank',0,[])
I actually get the following error:
??? Error: Type mismatch, argument 1
I don't know if it doesn't like the empty argument or which one.
"Yair Altman" <altma...@gmailDEL.comDEL> wrote in message <h4u5m6$nag$1...@fred.mathworks.com>...
Hi Richard,
You might try using '' (ie an empty string) instead of [] for the empty args argument.
Good Luck,
Donn