**Problem solved!**

You all are right. I tried to access the new document using "ThisComponent"
Thank you very much for enlighten me, and that so quickly!


Kind regards

On 6/8/07, Fernand Vanrie <[EMAIL PROTECTED]> wrote:

VELTIN Joffrey wrote:
> Hi everyone,
>
> New to this mail list and to OOo community.
>
> Here is my problem:
>
> I want to open a particular document from the active document from
> which I
> launch the macro. I use this code:
>
> '*****************************
> **************************************************************
>
>
> Sub OpenFile (FileName as String)
>
> dim args(1) as new com.sun.star.beans.PropertyValue
> dim FilePath, FileToOpen, FileURL as String
> dim TheDoc as Object
>
> FilePath = "C:\MyRecords\"
> FileToOpen= FilePath & FileName & ".ods"
>
> FileURL=ConvertToURL(FileToOpen)
>
> args(0).name="InteractionHandler"
> args(0).value=""
> args(1).name="MacroExecutionMode"
> args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
> TheDoc=StarDesktop.loadComponentFromURL(FileURL,"_blank",0,args())
>
>
> End Sub
>
>
'**********************************************************************************************
>
>
> Now, I would like to get access to this newly opened document... let's
> say I
> would like to add a column.
> As ThisComponent refers to the initial document, I cannot find a way to
> operate on the new document..
"thiscomponent" is the new opened doc
> Would you have some suggestions?

> Many thanks!
make objects from every opened document before opening a new one

hope i a correct an hope it helps :-)

>
> Best regards!
>
>
> Joffrey
>

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


Reply via email to