List Info

Thread: Re: Access to an opened document




Re: Access to an opened document
user name
2007-06-08 03:16:17
Hi,

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_EXE
CUTE_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.. Would you have some
suggestions?
I am not sure if i understand you, from where do you want to
access this 
document? In your macro "TheDoc" gives you access
on the new document 
and you can do whatever you want with it.

Juergen


> Many thanks!
> 
> Best regards!
> 
> 
> Joffrey
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )