Page 1 of 1
[Solved] Using Macro to open existing file in a new instance
Posted: Wed Nov 02, 2016 1:29 am
by johnnyideal
Hi, I am new with OO, I am trying to figure out how to open use a macro in a spreadsheet to open an existing saved spreadsheet in a new window. Thanks.
Re: Using Macro to open existing file in a new instance
Posted: Wed Nov 02, 2016 3:18 am
by FJCC
To open a file called CellRangeIndexing.ods that is on my desktop:
Code: Select all
FileName = "c:\users\fjcc\desktop\CellRangeIndexing.ods"
FileURL = convertToURL(FileName)
StarDesktop.loadComponentFromURL(FileURL, "_blank", 0, Array())
Re: Using Macro to open existing file in a new instance
Posted: Wed Nov 02, 2016 11:01 am
by Villeroy
New instance as if it were a template?
Code: Select all
sub open_as_template(sPathName)
sURL = convertToURL(sPathName)
dim a(0) as new com.sun.star.beans.PropertyValue
a(0).Name = "AsTemplate"
a(0).Value = True
StarDesktop.loadComponentFromURL(sURL, 0, "_blank", a())
end sub