I'd like to create folders from a list of cell values but I have no idea how.
Can anyone help?
Create folders from cell values
Create folders from cell values
OpenOffice 4.1.3 on Windows 10
- JohnSUN-Pensioner
- Volunteer
- Posts: 876
- Joined: Fri Jan 14, 2011 1:21 pm
- Location: Kyiv, Ukraine
Re: Create folders from cell values
Welcome to forum!
Which of the parts of this task be difficult - reading strings from the cells, or creating folders?
Which of the parts of this task be difficult - reading strings from the cells, or creating folders?
Code: Select all
Sub crtFldrByCellVals
Dim oDataArray As Variant
Dim oData As Variant
Dim sBaseDir As String
Dim sTrgtDir As String
Dim i As Long
GlobalScope.BasicLibraries.LoadLibrary("Tools")
sBaseDir = ThisComponent.getURL()
If sBaseDir <> "" Then sBaseDir = DirectoryNameOutOfPath(sBaseDir, "/")
Rem Get data from selected cells
oDataArray = ThisComponent.getCurrentSelection().getDataArray()
For i = LBound(oDataArray) To UBound(oDataArray)
oData = oDataArray(i)
Rem ... and create folder for each of them
sTrgtDir = ConvertToURL(sBaseDir & "/" & Trim(oData(0)))
If Dir(sTrgtDir, 16)="" Then MkDir(sTrgtDir)
Next i
End Sub
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English