Windows 8 App error: "class not registered" (visual basic) with Visual Studio when simply trying to open Outlook

1

I am fairly new to programming with Visual Studio/Visual Basic.

I am trying to write a Windows 8 Metro App with Visual Studio 2012 for Windows 8. I use Outlook 2007. It is supposed to open up an Outlook application but crashes with following error (hopefully without translation errors):

Additional Information: An instance of the COM-Component with CLSID {0006F03A-0000-0000-C000-000000000046} couldn't be created because of the following error of CoCreateInstanceFromApp : 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Make sure that your COM-Object is in the list of CoCreateInstanceFromApp.

This is all the code I put in except for the standard code provided by visual studio:

Imports Microsoft.Office.Interop 'at the very start
Dim oOutlook As New Microsoft.Office.Interop.Outlook.Application 'in Sub

I tried also:

Dim oOutlook As Outlook.Application = New Outlook.Application

as seen elsewhere.

I tried to find info online but they only relate to servers and un-approved COMs. Microsoft should approve of Outlook though.

What am I doing wrong and how do I fix this so it opens up a window of Outlook?

vba
outlook
com
windows-8
asked on Stack Overflow Jan 20, 2013 by user1995046 • edited Jun 26, 2020 by Martijn Pieters

1 Answer

0

The scenario you are trying to accomplish is not allowed. You cannot invoke code written specifically for the desktop inside of a modern UI. This includes Microsoft products, even Outlook. If you have the need for code to be shared, you can use the Portable Class Library when writing new code, but this will not help you invoke legacy code via COM or other mechanism.

answered on Stack Overflow Jan 20, 2013 by Jeff Brand

User contributions licensed under CC BY-SA 3.0