Home » excel » Automation error. Catastrophic failure error using Excel through Selenium and VBA

Automation error. Catastrophic failure error using Excel through Selenium and VBA

Posted by: admin May 14, 2020 Leave a comment


I am trying to fill a web form through selenium VBA. I have used some codes which used to work well . Now I have updated to new version of office and now when I try the same code it says

” Automation error. Catastrophic failure”

    Sub Rel_join()

        Dim bot As New ChromeDriver
        bot.Start "chrome", "******"
        Dim x, y,w
        bot.Get "/"
        bot.Wait 1500
        bot.Wait 500
        'select department
        d = "********"

        Set ele = bot.FindElementById("ddldept").AsSelect
        ele.SelectByText [d]
        bot.FindElementByXPath("//input[@id='txtusername']").SendKeys "*****"
        bot.FindElementByXPath("//input[@id='txtpwd']").SendKeys "******"
        'Navigate to service book
        bot.Get "***********URL"

           For y = 4 To 4
       ** x = ThisWorkbook.Sheets("sheet1").Range("w" & y).Value**
        cSCRIPT = "document.getElementById('txtempcd').value='" & x & "'"
        bot.ExecuteScript cSCRIPT
        cSCRIPT = "document.getElementById('Save').click()"
        bot.ExecuteScript cSCRIPT
        bot.Wait 3000
        Next y
    End Sub

I have also noticed that this error is shown on the line

 ** x = ThisWorkbook.Sheets("sheet1").Range("w" & y).Value**
How to&Answers:

This error message…

Automation error. Catastrophic failure

…implies that there was an Automation error while accessing the excel sheet based on Office 365.

As per the discussion in Automation error: Catastrophic failure Problem with Excel 2016 the main problem is related to the version of Excel that comes with Office 365 is different from the version that is given to Enterprise users.


The easiest solution would be to save the file as an Excel Binary Workbook and use it in your automated tests