After it's added the row of data the macro loops around again and when it comes to add the next data, I want it to do that on the next row.
The only way I can get this to work though, is by saving and closing the spreadsheet after each row has been added. If I don't I get an error message saying the spreadsheet is already open in another application and a Invalid Variant Operation Error message.
My subrouting code is:
Code: Select all
SRT>Write_Report
XLOpen>C:\Users\OJohnson\OneDrive - RNIB\Desktop\Files_in_TB_Library.xlsx,1,xlBook
SetFocus>Files_in_TB_Library.xlsx - Excel
Let>w=0
Repeat>w
Let>w=w+1
Let>Row=k+3
Let>Col=w+1
//TB Number
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%root_folder%,scResult_root_folder
//Is it Mass Ingested
Let>Col=w+2
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%MassIngest%,scMassIngest
//If Mass Ingested are there visible links in the NCC
If>MassIngest=Yes
Let>Col=w+3
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%NCCLinks%,scNCCLinks
Endif
//Which Data drive is it on
Let>Col=w+4
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%data%,scData
//Are there subfolders
Let>Col=w+5
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%SubCountResult%,scSubCountResult
//Names of Subfolders
If>subcount>1
Let>Col=w+6
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%sub_folder_result%n%,scSubfolders
Endif
If>subcount=1
Let>Col=w+6
XLSetCell>xlBook,Sheet1,%Row%,%Col%,subfolders%,scSubfolders
Endif
//Are MP3's Present
Let>Col=w+7
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%NoMP3Folder%,scNoMP3Folder
//Is MP3 File Name longer than 8 characters
Let>Col=w+8
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%MP3Length%,scMP3Length
//Name of MP3 File
Let>Col=w+9
XLSetCell>xlBook,Sheet1,%Row%,%Col%,%mp3_result%,scmp3_result
XLSave>xlBook,C:\Users\OJohnson\OneDrive - RNIB\Desktop\Files_in_TB_Library.xlsx
XLQuit>xlBook
END>Write_Report
Until>k=folder_names_count