there is a big difference between my marco and his,
I was using loadComponentFromURL.
but he uses createUnoService( "com.sun.star.sdb.DatabaseContext" )
when I tried to run his marco on my computer, my oo simply crushed:(

2006/6/5, Andrew Jensen <[EMAIL PROTECTED]>:

li pan wrote:
Hi, I tried to create a database use macro like this:

Sub Main
   sDBUrl = "private:factory/sdatabase"
   oDoc =
StarDesktop.loadComponentFromURL(sDBUrl,"_blank",0,Array())
   oDoc.URL = "sdbc:embedded:hsqldb"
End Sub

but OO said that the URL property is readonly and can't be modified.
if I comment out that line

Sub Main
   sDBUrl = "private:factory/sdatabase"
   oDoc =
StarDesktop.loadComponentFromURL(sDBUrl,"_blank",0,Array())
End Sub

the database will open but I can't modify anything of it.
the table wizard, the query wizard are disabled. and the url property
of it can't be modified too.

I have tried private:factory/sdatabase?Interactive, but the
problem is
that I can't set the file name of it by macro, the wizard always ask
for a file name in the last step.
How can I create a empty database by macro? please help.

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


Il,

I believe your problem is that you must save the file before you can
actually change anything in it. ( might be wrong on that...I am often enough
)

You might want to grab the document AndrewBase.odt by Andrew Pitonyak at
http://www.pitonyak.org/oo.php

The first example macro shows how to do this.

Sincerely

Drew



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

Reply via email to