Ask a Question

Excel file is blocked

ḥari
Frequent Contributor

Excel file is blocked

Hi Team,
I have accessing datas from excel but suddenly I am getting error as "excel internal error 'element nit round" And "access to the excel file is blocked, possible because it is open in excel" But excel is closed.
Previously it's executed fine only suddenly it happens for current script which I am working.
May I know the possibility for this error?
16 REPLIES 16
ḥari
Frequent Contributor

@rraghvani previously executed script also getting same error. Any other possibilities.
rraghvani
Champion Level 3

If you can create a sample project, which reproduces the issue, then I can have a look. Other than that, it's not possible without looking at the code.

jkrolczy
Regular Contributor

Maybe add a step at the beginning of your script to close all Excel instances to be sure you have nothing to interfere during your actual test steps dealing with Excel.

JamesK
ḥari
Frequent Contributor

@jkrolczy I am using excel objects to open the excel and get the sheet name

Var excelfile=Excel.Open("") ;
Var excelSheet=excelfile.SheetByTitle("") ;


Here, in Excel we have only open and create methods available.
May I know how to close the application for this Excel method.
jkrolczy
Regular Contributor

//
// Close all excel instances
function closeExcelInstances()
{
var childcounts = Sys.ChildCount;
for(var count=0; count<childcounts; count++)
{
if(Sys.WaitProcess("Excel", 0).Exists == true)
{
var processcount = count + 1;
Sys.Process("Excel").Terminate();
Log.Message("Excel processs count: " +processcount+ " successfully closed");
Sys.Refresh();
childcounts = Sys.ChildCount;
count=0;
}
}
return;
}

=============

var ExcelFilePath = ""+Sys.OSInfo.TempDirectory+""+excelfile+"";
var SheetName = "Sheet1";

// Open the above Excel file through Sys.OleObject
var MsExcel = Sys.OleObject("Excel.Application", "");

MsExcel.Workbooks.Open(ExcelFilePath);

var Sheet = MsExcel.Sheets.Item(SheetName);

 

.

.

// Close Sys.OleObject for Excel application
MsExcel.Quit();
Delay(1000);

// Select 'No/Don't Save' button
selectMicrosoftExcelInfoDontSaveBtn();


 

 



 

 

JamesK
ḥari
Frequent Contributor

@jkrolczy i don't think closing excel is a problem here, same coding I have tried to execute in other machine without modifying it is executing. I am not sure what's the issue
rraghvani
Champion Level 3

Neither of these statements "excel internal error 'element nit round" and "access to the excel file is blocked, possible because it is open in excel" are standard error messages.

 

Are you able to provide the exact screenshot of the error messages you are receiving?

cancel
Showing results for 
Search instead for 
Did you mean: