How to call app (eg, Outlook) from Add-in Express for IE addon?

Add-in Express™ Support Service
That's what is more important than anything else

How to call app (eg, Outlook) from Add-in Express for IE addon?
 
Vadim Usmanov


Guest


Hello,
Please tell me: is there a way to call app (eg, Outlook) from Add-in Express for IE addon?

Following the example of code that does not work (security?):

  Dim myOlApp, myMail
        myOlApp = CreateObject("Outlook.Application")
        myMail = myOlApp.CreateItem(Outlook.OlItemType.olMailItem) 'create new mail
        myMail.Display() 'Display Mail
Posted 31 Mar, 2012 15:00:55 Top
Eugene Astafiev


Guest


Hi Vadim,

Yes, there is a way. Please use the COM Automation technology. You can read more about this in the http://msdn.microsoft.com/en-us/library/y1xatbkd%28v=vs.80%29.aspx article in MSDN. Also I have found a sample http://support.microsoft.com/kb/977998 for you.
Posted 02 Apr, 2012 04:37:28 Top
Vadim Usmanov


Guest


Thanks, Eugene!
I can create a new mail in Outlook (NB: run IE-addon outside VS!):
Dim myOlApp, myMail   
      myOlApp = CreateObject("Outlook.Application")   
      myMail = myOlApp.CreateItem(Outlook.OlItemType.olMailItem) 'create new mail
      Dim DocURL = Me.HTMLDocument.url 
      myMail.Subject = DocURL
      myMail.Display() 'Display Mail  


I also can create Excel object using code:
   Dim objExcel = CreateObject("Excel.Application")
        Dim ExcelWorkbook = objExcel.Workbooks.Add
        Dim ExcelWorksheet = ExcelWorkbook.Worksheets(1)
        objExcel.Visible = True

        Dim Wbook
        For Each Wbook In objExcel.Workbooks 
            MsgBox("Wbook.Name: " & Wbook.Name)
        Next Wbook

But I couldn't get running Excel:
Dim objExcel = GetObject(, "Excel.Application") 

What do you think about this issue?
Posted 02 Apr, 2012 18:26:29 Top
Eugene Astafiev


Guest


Hi Vadim,

Do you get any exceptions or errors messages?

Anyway, please take a look at the http://support.microsoft.com/kb/238610 article and the http://social.msdn.microsoft.com/Forums/en/exceldev/thread/500e8851-e7bd-47da-9eac-4233bebd8e5a thread.
Posted 03 Apr, 2012 04:34:23 Top
Vadim Usmanov


Guest


Thank you, Eugene!
I tried to use the article http://support.microsoft.com/kb/238610. It did not help me. Exception is
Can't create ActiveX component

(more precisely in Russian: "Не удалось создать компонент ActiveX")
Posted 05 Apr, 2012 17:51:52 Top
Eugene Astafiev


Guest


Hi Vadim,

Please take a look at the http://support.microsoft.com/kb/238610 article. It describes your case:

ActiveX component can't create object


Am I on the right avenue?
Posted 06 Apr, 2012 08:46:08 Top
Vadim Usmanov


Guest


I use Russian version of VS and I think "Не удалось создать компонент ActiveX" - not quite accurate translation of message "ActiveX component can't create object"
Posted 06 Apr, 2012 09:00:32 Top
Eugene Astafiev


Guest


Hi Vadim,

What line of code fires the exception? Are you able to reproduce the issue with a regular windows forms application?

Do you run IE under the Protected Mode? If so, could you please try to turn the Protected Mode off and then close all IE instances. Are you able to reproduce the issue now (with Protected mode turned off)?
Posted 06 Apr, 2012 09:10:44 Top
Vadim Usmanov


Guest


Hello, Eugene!

Sorry for the long pause and thanks for help.

Eugene Astafiev writes:
Do you run IE under the Protected Mode? If so, could you please try to turn the Protected Mode off and then close all IE instances. Are you able to reproduce the issue now (with Protected mode turned off)?


I turn the IE Protected Mode off and I can get running Excel! But maybe there is a way to get Excel from the Protected Mode?
Posted 24 Apr, 2012 13:34:59 Top
Eugene Astafiev


Guest


Hi Vadim,

Nope. Applications (Excel and IE) are run in different integrity levels. Please read more about this in the http://msdn.microsoft.com/en-us/library/bb625964.aspx section in MSDN.
Posted 25 Apr, 2012 05:01:16 Top