Forum Discussion

Accounts1977's avatar
3 years ago

Error when Sending Emails & PO's from MYOB

This is a major problem for our business at the moment since our computers have upgraded to Windows 11 - the situation needs to rectified ASAP as we are unable to track our emails for PO's being sent to suppliers.

 

AccountRight Application Error Report

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

Application Version: 2022.1.24.5785

Application File Version: 2022.1.24.5785 Incident Id: 7e6d4cb1-916d-4daa-9fa0-f7b7d636e463

Time: Tuesday, 22 February 2022 1:37:03 PM

 

Code:

System.InvalidCastException

 

 

Message:

Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).

 

 

Stack Trace

----------------------------------------

1 : System.InvalidCastException

----------------------------------------

System.InvalidCastException: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).

   at mscorlib!0x06004227!System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)

   at Microsoft.Office.Interop.Outlook!0x06002365!Microsoft.Office.Interop.Outlook.ApplicationClass.CreateItem(OlItemType ItemType)

   at Huxley.MsOffice.Integration!0x06000078!MYOB.Huxley.MsOffice.Integration.OutlookEmail.OutlookEmailProvider.SendMessage(String emailAddresses, String subject, String body, EmailResourceType resourceType, String documentNumber, IEnumerable`1 attachments) +0xf4

   at Huxley.UI.Controllers!0x0600255b!MYOB.Huxley.UI.Controllers.Helpers.EmailHelper.SendEmail(String to, String subject, String body, String pdfFileName, EmailResourceType resourceType, FormTemplateDefinition formTemplateDefinition, FormPrintingParams formPrintingParams, IEnumerable`1 attachements, Nullable`1 entityUid, LayoutType layoutType, String documentNumber) +0xd0

   at Huxley.UI.Controllers!0x06001e55!MYOB.Huxley.UI.Controllers.SalesAndPurchases.SendEmailController.SendEmail(String emailAddress, String subject, String message, IEnumerable`1 attachments) +0x6c

   at Huxley.UI.Controllers!0x06001e54!MYOB.Huxley.UI.Controllers.SalesAndPurchases.SendEmailController.SendEmail(String emailAddresses, String subject, String message) +0xb

   at Huxley.UI.Forms!0x06001eb6!MYOB.Huxley.UI.Forms.SalesAndPurchases.SendEmail.<OnOkClicked>b__22_0() +0x0

   at Huxley.UI.Forms!0x06002713!MYOB.Huxley.UI.Forms.BaseForms.BaseViewContainer.PerformAction(Action methodToPerform) +0x16

   at Huxley.UI.Forms!0x06001e96!MYOB.Huxley.UI.Forms.SalesAndPurchases.SendEmail.OnOkClicked(ButtonClickedArgs args) +0x48

   at Huxley.UI.Forms!0x060023f8!MYOB.Huxley.UI.Forms.BaseForms.BaseViewForm.CallButtonClicked(Action`1 execute, ButtonClickedArgs args, String buttonText) +0x12

   at Huxley.UI.Forms!0x06002372!MYOB.Huxley.UI.Forms.BaseForms.BaseViewForm.btnOk_Click(Object sender, EventArgs e) +0x30

   at System.Windows.Forms!0x06000e1d!System.Windows.Forms.Control.OnClick(EventArgs e) +0x19

   at DevExpress.XtraEditors.v17.1!0x06000d4f!DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e) +0x2e

   at DevExpress.XtraEditors.v17.1!0x06000d48!DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e) +0x1d

   at System.Windows.Forms!0x06000f04!System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) +0x184

   at System.Windows.Forms!0x06000f14!System.Windows.Forms.Control.WndProc(Message& m) +0x49f

   at DevExpress.Utils.v17.1!0x06002708!DevExpress.Utils.Controls.ControlBase.WndProc(Message& m) +0x2e

   at DevExpress.XtraEditors.v17.1!0x06000256!DevExpress.XtraEditors.BaseControl.WndProc(Message& msg) +0x0

   at System.Windows.Forms!0x0600572a!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) +0x0

   at System.Windows.Forms!0x0600572d!System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) +0x8e

   at System.Windows.Forms!0x06002df3!System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) +0x25 ==========

MODULE: DevExpress.Utils.v17.1 => DevExpress.Utils.v17.1, Version=17.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a; G:b8c34c059b804930811d5f6d50999b6c; A:1

MODULE: DevExpress.XtraEditors.v17.1 => DevExpress.XtraEditors.v17.1, Version=17.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a; G:6df94e55f5bd4444b910d4b2a37076a4; A:1

MODULE: Huxley.MsOffice.Integration => Huxley.MsOffice.Integration, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:e2ec0d0e7fbe43bbb5a4507d4e01c1bc; A:1

MODULE: Huxley.UI.Controllers => Huxley.UI.Controllers, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:dcef6c6089d64857839185158c58fec5; A:1

MODULE: Huxley.UI.Forms => Huxley.UI.Forms, Version=2022.1.24.5785, Culture=neutral, PublicKeyToken=947f70fecdd4159f; G:1ad86eff507c4534a329c5a182233234; A:1

MODULE: Microsoft.Office.Interop.Outlook => Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c;

MODULE: mscorlib => mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089; G:3580705f3f48422abfe7262f8586dcb8; A:2

MODULE: System.Windows.Forms => System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089; G:43eb03968e784a6cae5757b9b473b959; A:1

 

  • Hi Accounts1977 

     

    The error log mentions this specific error, " System.InvalidCastException: Unable to cast COM object of type 'Microsoft.Office.Interop"

     

    Generally, this error means that when a program such as AccountRight asks which version of Outlook is installed, the wrong version is being reported back, causing a communication problem and errors between the programs. This can happen when different versions of Office may have been previously installed on the computer, and components/values are left behind.

     

    There is a range of interop errors, these most often are fixed by one of the following:

     
    1. Quick Repair office. (any missing files should be added back), if it doesn't work, move to the next step.
    2. Re-install Microsoft Outlook. ( If this doesn't work either, please follow the next step).
    3. Re-Register DLL files and Check/Fix Registry Keys (there are 3 to complete)

    Step 3 would require an IT Professional as its an environmental issue, with windows having missing or incorrect information and this help article has similar instructions which might help: 

    https://webmakers.co.nz/interface-not-registered-exception-from-hresult-0x80040155-microsoft-office-...