Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to scan all the excel files' info into [LoadedTables] from a shared location (D:\SharedExcelFiles)
I have created an ODBC connection. but if anyone keeps an excel file open I am getting this error while loading.
"The Microsoft Access database engine cannot open or write to the file. It is already opened exclusively by another user, or you need permission to view and write its data."
I wanted to skip this error and scan the next excel file connection.
something like this
FOR EACH file in FileList(Path &'\*.' &'xlsx');
if ( excel file is not opened by another user / ODBC connection is fine)
then ODBC CONNECT32 TO [SOH_Excel_Files;DBQ=$(file)];
else
next file
----------------------------------------------------------------------------
Current working code to scan subfolders is >>
sub ScanFolder(Root)
FOR EACH file in FileList(Root &'\*.' &'xlsx');
//In order to get the file information from SQLtables command making use of the ODBC connection format
ODBC CONNECT32 TO [SOH_Excel_Files;DBQ=$(file)];
LoadedTables:
SQLtables;
DISCONNECT;
next file
for each SubDirectory in DirList(Root &'\*')
call ScanFolder(SubDirectory)
next SubDirectory
end sub
Call ScanFolder('D:\SharedExcelFiles');
The list of Error Variables can be found here:
The other option might be ErrorMode:
Regards,
Brett