Hello all,

Recently I get a piece of Basic macro and test it in my computer. But I
met problems when running it. The problem can be described as follows:

1. Open a new writer document. Save it as whatever.odt.
2. Select Tools -> Macros -> Organize Macros -> OpenOffice.org Basic...
from the menu to open the OpenOffice.org Basic Macros dialog.
3. Create whatever.odt a new module, with the following macro:
--------------------------------------------
REM ***** BASIC *****

Sub Main
oFrame=thiscomponent.getcurrentcontroller.getFrame
dim args(0) as new com.sun.star.beans.PropertyValue
oFrame.loadComponentFromURL("private:factory/swriter", "_self",23, args)
End Sub
--------------------------------------------
5. Save whatever.odt and close it.
6. "Enable Macros" on reopening whatever.odt.
7. Reopen the module we created above in the editing window.
8. Run the module from the toolbar. And the application crashes, instead
of opening a new writer document as expected.

However, if this macro is run in a "Untitled" document, or run directly
from Tools -> Macros -> Run Macro. The result is all right.

I felt it was strange, and so could you help figure out where the source code 
goes wrong?
Thank you in advance. :-) 

Best regards,
Liang Weike 


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

Reply via email to