Export to Excel instance failure/error - Object does not match target type. Export is cancelled

I have been having issues with Toad Data Point's Excel exporting functions. When exporting to an Excel instance by any option I get a failure "Object does not match target type." This previously worked but has been broken for several months or more. I'm also unsure of any specific change point that caused it to stop working. I upgraded to 6.0.5.425 today to see if that would solve the problem, but it has not. I've researched other threads but am not finding direct correlation between their issues and mine. I suspect there could be some remnant Office related data on my system from a prior version as my organization did switch to Office 365 within the past 6-12 months. I'm hoping someone here can help point me in a direction to investigate so I can try to resolve this. I pasted the error and also my output after running Toad with --excelverbose=1.

Thank you in advance for any assistance or tips you can offer!

Error log:
8:52:42 PM Thread (21) Export Started [9/14/2022 8:52:42 PM]
8:52:42 PM Thread (21) Export using connection: MXRPT (SVCMAXTRNSOPS), MAXIMO
8:52:42 PM Thread (21) Export using connection: MXRPT (SVCMAXTRNSOPS), MAXIMO
8:52:42 PM Thread (21) Export Wizard: Building object list
8:52:42 PM Thread (21) Exporting Data (1 of 1)
8:52:42 PM Thread (21) Object SQL Query started.
8:52:42 PM Thread (12) DoneReadTreadWriter
8:52:43 PM Thread (12) User cancelled
8:52:43 PM Thread (12) DoneReadThreadWriter finally - adapter null
8:52:43 PM Thread (21) Object SQL Query finished with error: Object does not match target type.
8:52:43 PM Thread (21) at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object args, Boolean byrefModifiers, Int32 culture, String namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object providedArgs, ParameterModifier modifiers, CultureInfo culture, String namedParams)
at Quest.Toad.ImportExport.Writers.WriterExcelInstance.TryCultureGetProperty(Type type, String property, Object target, Object args)
at Quest.Toad.ImportExport.Writers.WriterExcelInstance.InitializeExcelPIA()
at Quest.Toad.ImportExport.Writers.WriterExcelInstance.WriteHeader(Object tableObject)
at Quest.Toad.ImportExport.ExportObjectData.DoneReadThreadWriter()
8:52:45 PM Thread (21) Export Finished [9/14/2022 8:52:45 PM]

8:52:45 PM Thread (21) Export time = 00:00:02.9364842

Excelverbose output:

Category Timestamp Message
Statusbar 9/14/2022 9:04:38 PM Export Started [7]
Excel Automation 9/14/2022 9:04:39 PM InitializeExcelApp(): excelPIA.FullName = Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c ;
Excel Automation 9/14/2022 9:04:39 PM InitializeExcelApp(): excelVersion =15.0.0
Excel Automation 9/14/2022 9:04:39 PM InitializeExcelApp(): officePIA.FullName = office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
Excel Automation 9/14/2022 9:04:39 PM InitializeExcelApp(): excelApp = Microsoft.Office.Interop.Excel.ApplicationClass ;
Excel Automation 9/14/2022 9:04:39 PM InitializeExcelApp(): type_Excel.FullName =Microsoft.Office.Interop.Excel.ApplicationClass
Excel Automation 9/14/2022 9:04:39 PM ApplicationClass get_Version target Microsoft.Office.Interop.Excel.ApplicationClass
Excel Automation 9/14/2022 9:04:39 PM ApplicationClass get_Workbooks target Microsoft.Office.Interop.Excel.ApplicationClass
Excel Automation 9/14/2022 9:04:39 PM Workbooks Add target System.__ComObject
Excel Automation 9/14/2022 9:04:39 PM _ Arg: System.Reflection.Missing
Excel Automation 9/14/2022 9:04:39 PM Workbook get_Worksheets target System.__ComObject
Excel Automation 9/14/2022 9:04:39 PM First-time exception when getting Worksheets
Statusbar 9/14/2022 9:04:41 PM Export Finished [7], errors detected, click for summary.

After additional research about the Microsoft Office Primary Interop Assemblies Redistributable, I believe I may have solved it. It seems like newer versions of MS Office don't require the PIA. Another application's thread about PIA issues suggested repairing the MS 365 installation. Fortunately, I have a local admin account on my machine. I was able to run an administrator command prompt to open appwiz.cpl (the Programs and Features part of the Control Panel). From there I was able to perform a repair on the "Microsoft 365 Apps for enterprise" installation. That seems to have resolved my Excel export issues.

Welcome to the Toad DataPoint forum, BTW, and glad to hear that you've resolved the issue.
In case the same message pops up again, there could be several reasons for the cause.
Check out the TDP knowledge base articles on the Quest Support site that deal with this issue for possible causes and resolutions/work-arounds:

https://support.quest.com/toad-data-point/kb?k=Object+does+not+match+target+type&cause=

1 Like

Thanks for the quick response Gary! I had looked there as well as other general Google searches. Everything I was finding was for older versions of Excel or Toad and didn't really align to my issues or system. I'm currently working so hopefully it stays that way, exporting to Excel is highly useful functionality and manually building data connections in an Excel book for the last several months was a bit painful.