Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
sheetnames() leaves Excel file locked?
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
In a debugging session, something seemingly bizarre occurred -- function is to create an Excel sheet for import into another product; the file is given by the variable FTemplate and has been previously read from by readtable() and confirmed the file can at this point be opened in Excel as writeable.
There are a whole bunch of sheets in the file and they're not named in a really convenient way, so while stopped in the debugger I executed sheetnames(FTemplate) in order to get the desired sheet name to use to write a test section of data and
K>> shts=sheetnames(FTemplate);
K>> sht=shts(contains(shts,'6.30.24'))
sht =
"Journal Entries -BegBal 6.30.24"
K>> writetable(tJE,FTemplate,'Sheet',sht,'Range','A10','PreserveFormat',1,'WriteVariableNames',0)
Unable to write to file 'C:\SCCC Foundation\Financial\FinancialEdge\ImplementationDocuments\FENXT Import Templates 2024 - SCCCF.xlsm'. You may not have write permissions
or the file may be open by another application.
K>>
BOOM! the file is now locked. Looking with Task Manager, indeed there is a new Excel process in the background and it has the file locked...if one ends that task, then
K>> writetable(tJE,FTemplate,'Sheet',sht,'Range','A10','PreserveFormat',1,'WriteVariableNames',0)
K>>
lets one write to the file.
This is apparently a bug; I found in Task Manager earlier some 30 or more Excel processes hanging around that had apparently been created over the last week by this; I had no idea what had caused that to have happen until now. I had just rebooted to get rid of all those zombie processes when ran the above.
Has anybody else observed this and does it still occur in later releases before submitting a bug report?
3 Kommentare
Stephen23
am 27 Nov. 2024 um 22:07
Even if this only occurs when debugging it would still deserve a bug report.
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!