Here’s the working version, again, in my stash cause it’s still big:
https://www.deviantart.com/stash/0112b7z941d5.
.
It took a bit over ten minutes to recreate the idx for the English (US) thesaurus
I don’t like having to go through the menus to activate the macro; it’s just something else to fluster a casual contributor
So I’m going to add controls ; go figure
since I’m going to do that, figure I’d redesign the document
Sheet 1: instructions
Sheet 2 : buttons (generate idx, export files(?)), dat entries, idx output
Sheet 3: (stub right now) dat combiner w/ any controls it needs, possibly one to copy the combined dat to
Sheet 4: calc data manipulation; locked to prevent casual user from gumming the works, but no pass so others can maintain it should the standards for the files change
.
here’s my basic code, any ideas on how to steamline it:
Sub Main
dim aIndexRawM() as string 'the data extracted from the idx sheet will be filled into this array
Dim oSheet 'Sheet Ref, sheet idx ()
Dim oRange 'range of cells to write to
Dim oCell 'Cell Ref
Dim oCell2
Dim lngArrayLimit as long
Dim oCellStr 'string from the cell
dim strCell as string
dim lngRange as long 'length of the aIndexRawM array
oSheet = ThisComponent.getSheets.getbyindex(2) 'set sheet to idx
oCell=osheet.getcellByPosition(11,10)
lngArrayLimit=oCell.getvalue()
redim aIndexRawM(lngArrayLimit) as string
Dim I as long 'index array
Dim R as long 'reference to calc
Dim A as long 'loop to write to calc
I=0
for R = 2 to lngArrayLimit 'L11 (11, 10) is limit, itterate down colum J (11)
oCellStr=oSheet.getCellByPosition(9,R)
strCell=oCellStr.getString()
if len(strCell)>0 then 'check to see if the cell has a string in it
aIndexRawM(I)=strCell 'assign string into the array
I=I+1 ' increment array address by 1 after the value has been assigned
end if
Next R
lngRange=I+1 'just to ensure that needed data isn't lost
A=0
for A=0 to lngRange
oCell2=osheet.getcellByPosition(0,A+2)
oCell2.setString(aIndexRawM(A))
Next A
End Sub
It will get moved into a ‘generateIdx’ sub later
.
just realized that I forgot to add the part about activating the macro,
Oh well, I’ll start changing the layout sunday or monday and it won’t matter once I add buttons
.
found a few issues, mainly formula to cell linking, so I will likely have to leverage more operations through macros.
issues:
when adding lines, you have to select and drag columns B C & D from a few lines above the addition to a few lines below
Likewise, the formulas on the idx page remain linked to the cells that have shifted, which throws the table out of orientation. currently, the only fix is to copy the formula in cell F3, and paste it back into the column
.
My solution to these is going to be to paste the relevant formulas using a macro as the first set of operations