I have bunch of file names on a column in calc. I have created files with names of many of them. But for the ones that I have not created a file yet, I want the macro to create a file during the process.
The code I have made is here below. I don't understand what is wrong with it. The system says "Url seems to be an unsupported one"
I have looked for some other topics about unsupported url, but no joy, it seems like my case is a bit more amateurish. And could not find a useful solution. anyone with an idea?
Code: Select all
SUB IFITAS
DIM CELL1 AS OBJECT
DIM URLS AS STRING
CELL=THISCOMPONENT.SHEETS(0).GETCELLRANGEBYNAME("H2")
elementURL1 ="file:///C:/Users/Sokolowitzky/Desktop/3072NAMEb/" + CELL1.STRING + ".ods"
IF ISMISSING(elementURL1) THEN
elementURL1 = "private:factory/scalc"
ELSE elementURL1 ="file:///C:/Users/Sokolowitzky/Desktop/3072NAMEb/" + CELL1.STRING + ".ods"
END IF
elementDoc = starDeskTop.loadComponentFromURL ( elementURL1 , "_blank", 0, array())
'elementDoc.CurrentController.Frame.ContainerWindow.setVisible(False)
omainsheet=elementDoc.sheets(0)
IF NOT ISMISSING(elementURL1) THEN
elementDoc.store(TRUE)
else sSaveToURL1 = elementURL1
elementDoc.storeASUrl(sSaveToURL1, Array())
END IF
END SUB