I am automating an Excel Plugin through UFT. I launch excel using CreateObject as:
Set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Add
oExcel.Visible = True
Before proceeding, I want to make sure my add-in is correctly installed. So I do this:
For K = 1 To oExcel.AddIns.Count Step 1
If Trim(oExcel.AddIns.Item(K).Name) = "AddInName.xll" Then
If oExcel.AddIns.Item(K).Installed Then
oExcel.AddIns.Item(K).Installed = False
wait (2)
oExcel.AddIns.Item(K).Installed = True
wait (2)
If oExcel.AddIns.Item(K).IsOpen Then
'Reporter.ReportEvent micPass, "Add_In Successful", "Successfully loaded Add_In"
Exit For
End If
End If
End If
Next
Now this has been working without any issues in Window 7 + Office 2010 configuration. However, my firm recently moved to Windows 10 + Office 2016 environment and following line started throwing error now:
oExcel.AddIns.Item(K).Installed = True
the line before that (setting installed state to false) works fine. The error being thrown is:
The Ribbon/COM add-in helper required by add-in <> could not be registered. This is an unexpected error. ExcelDna.Integration Information: 4 : LoadComAddIn exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Things that I have tried:
So what's happening with CreateObject within UFT? Clearly it's UFT which is causing problem since it works fine through standalone VBS file!!
Any Help is greatly appreciated.. Thank you!!!
User contributions licensed under CC BY-SA 3.0