none
Outlook form region import error visual studio 2015 RRS feed

  • Question

  • I get the following error when attempting to import an outlook form into my visual studio project:

    unable to cast com object of type 'System.__ComObject'

    to interface type 

    'Microsoft.Vbe.Interop.Forms.UserForm'

    This operation failed because the QueryInterface call 

    on the COM component for the interface with IID "......" failed 

    due to the following error: Interface not registered

    (Exception from HRESULT:0x80040155)

    Please help/advise.

    Monday, August 24, 2015 9:22 PM

Answers

  • Up most of the night and finally figured it out... Under windows 8 (and 10) in order to import an .ofs, you have to run visual studio as an administrator (even though mylogin was an administrator, you still have to click on "run as administrator" on the program).  It is apparently some type of access issue as importing the form opens outlook and modifies registry entries in a manner only allowed when running VS as an "uber" administrator.

    Thank you both for your help.

    Wednesday, August 26, 2015 4:22 PM

All replies

  • You need to use an instance of the System.Windows.Forms.Form class instead.
    Tuesday, August 25, 2015 4:50 AM
  • Hi Hmerchen,

    Did you get this error message when you create an form region which import from file? I am failed to reproduce this issue using Outlook 2013 and Visual Studio 2015.

    What's version of Office installed on the development machine? And would you mind sharing more detail with us to help to reproduce this issue.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 25, 2015 8:07 AM
    Moderator
  • Office 365 click to install, Outlook 2013, Visual Studio Community 2015.

    I received the error message when taking the following steps (in existing projects and new, empty projects -= projects are outlook 2013 add-in):

    1.  Add Windows form.

    2.  Select Outlook form region.

    3.  Import Outlook form storage (.0fs) file.

    4.  Select previously created .ofs (created in click to install Outlook 2013).

    5.  Attach it to appointment as adjoining region.

    6.  Error message generated.

    Please advise as I upgraded and this has brought my current project to a screeching halt.  Thanks!

    Tuesday, August 25, 2015 1:45 PM
  • I am using the import .ofs wizard via visual studio; there is no way to use the instance of System.Windows.Forms.Form class to import/link to an .ofs file created in Outlook that I am aware of.  Please advise as your suggestion is appreciated but I'm not sure how to implement if it is applicable.
    Tuesday, August 25, 2015 3:51 PM
  • Additionally, could the problem be related to the fact that my office 365 install (including outlook) is click to run?  If that is the problem, how do I create add-ins for click to run office applications?
    Tuesday, August 25, 2015 4:11 PM
  • And to clarify, I need to use an .ofs imported form as that is the only way to bind controls to outlook fields, so simply using a standard form will not suffice.
    Tuesday, August 25, 2015 4:45 PM
  • Hi Hmerchen,

    Thanks for the detail information for this issue. Can you open the form region in Outlook when you design a form like figure below:

    In addtion, I also suggest that you try to update the Visual Studio and Outlook to the latest version to see whether the issue was fixed.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, August 26, 2015 8:55 AM
    Moderator
  • Up most of the night and finally figured it out... Under windows 8 (and 10) in order to import an .ofs, you have to run visual studio as an administrator (even though mylogin was an administrator, you still have to click on "run as administrator" on the program).  It is apparently some type of access issue as importing the form opens outlook and modifies registry entries in a manner only allowed when running VS as an "uber" administrator.

    Thank you both for your help.

    Wednesday, August 26, 2015 4:22 PM
  • The HKLM hive requires admin privileges, so you need to run applications elevated.
    Wednesday, August 26, 2015 4:32 PM