Forum Discussion

ḥari's avatar
ḥari
Frequent Contributor
7 months ago

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

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You are better off using Excel.Application COM object, as this will use the current version of Excel - providing you have it installed.

     

    If you can provide code, which the error always occurs. Then I can try and diagnose the issue for you.

    • ḥari's avatar
      ḥari
      Frequent Contributor
      rraghvani previously executed script also getting same error. Any other possibilities.
  • jkrolczy's avatar
    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.

    • ḥari's avatar
      ḥ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's avatar
    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();


     

     



     

     

    • ḥari's avatar
      ḥ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's avatar
    rraghvani
    Champion Level 3

    There's most likely an instance of Excel running which is not visible - use Task Manager and kill the application.

    • ḥari's avatar
      ḥari
      Frequent Contributor
      I didn't open or close excel through script I just fetching datas from excel
  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Try and be more specific please. Are you using Excel object, DDTDriver object ?

    • ḥari's avatar
      ḥari
      Frequent Contributor
      Excel objects only... It suddenly happened from yesterday onwards it's taking excel datas in between this error coming.
  • rraghvani's avatar
    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.

  • rraghvani's avatar
    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?