Our finance team currently have an ancient Excel file with a VBA macro that they use to get the contents of a folder and compare data with
Currently this points at our on-prem NAS and we'd like to move them away from that into Sharepoint.
So rather than pointing at
\\file-nas-01\finance\data
it points at
https:\\[sharepoint].finance.com\folder\folder
Is there a good resource to help convert this into an Office Script?
Or am I able to just reframe the full VBA into an office script and are there any guides to do so?
Some of the code from the VBA Macro below;
' setting the variables for the process
Dim folder_path As String: folder_path = Cells.Find("Folder with files you want to count:").Offset(1, 0)
Dim document_type As String: document_type = Cells.Find("What type of files do you want to check?").Offset(1, 0)
Dim next_history_row As Long: next_history_row = Sheets("History of Counter").Range("A1048576").End(xlUp).Row + 1
Dim total_count As Long
Dim total_money As Double
'getting the total count of the files and the money value of the files
total_count = get_file_count(folder_path, document_type)
total_money = get_money_from_files(folder_path, document_type)
'Put the next row of data in the history to record outcomes of what folder was checked,
' for what type, by who and when
Workbooks(ThisWorkbook.Name).Sheets("History of Counter").Range("A" & next_history_row) = folder_path
Workbooks(ThisWorkbook.Name).Sheets("History of Counter").Range("B" & next_history_row) = document_type
Workbooks(ThisWorkbook.Name).Sheets("History of Counter").Range("C" & next_history_row) = total_count
Workbooks(ThisWorkbook.Name).Sheets("History of Counter").Range("D" & next_history_row) = total_money
Workbooks(ThisWorkbook.Name).Sheets("History of Counter").Range("E" & next_history_row) = Date
Workbooks(ThisWorkbook.Name).Sheets("History of Counter").Range("F" & next_history_row) = Environ("username")