Home All Groups Group Topic Archive Search About

Outlook.Application is not defined. PIA installed and setup correctly.

Author
29 Mar 2005 10:07 PM
tony_pez
First timer be gentle.  I have this code I am trying to put into a
vb.net addin for ol2003.  I get the error Outlook.Application and
Outlook.Selection is not declared.  I have installed the PIA's and made
sure they are pointing to the GAC.  Any ideas would be apreciated.

Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Outlook

Public Sub SendToSpam()
    Dim objOL As Outlook.Application
    Dim objSelection As Outlook.Selection
    Dim objMsg As Object
    Dim objNewMsg As Object

Author
29 Mar 2005 10:52 PM
Jay B. Harlow [MVP - Outlook]
Tony,
Change:

> Imports Microsoft.Office.Interop.Outlook

To:

    Imports Outlook = Microsoft.Office.Interop.Outlook

You were importing Outlook itself, hence you could have used just
Application instead of Outlook.Application... To avoid name conflicts
between System.Windows.Forms.Application & Outlook.Application I normally
use the above namespace alias.

Hope this helps
Jay

<tony_***@yahoo.com> wrote in message
Show quoteHide quote
news:1112134045.490613.68350@l41g2000cwc.googlegroups.com...
> First timer be gentle.  I have this code I am trying to put into a
> vb.net addin for ol2003.  I get the error Outlook.Application and
> Outlook.Selection is not declared.  I have installed the PIA's and made
> sure they are pointing to the GAC.  Any ideas would be apreciated.
>
> Imports Extensibility
> Imports System.Runtime.InteropServices
> Imports Microsoft.Office.Core
> Imports Microsoft.Office.Interop.Outlook
>
> Public Sub SendToSpam()
>    Dim objOL As Outlook.Application
>    Dim objSelection As Outlook.Selection
>    Dim objMsg As Object
>    Dim objNewMsg As Object
>
Author
30 Mar 2005 9:47 PM
tony_pez
That worked!  thanks a lot.

However, once I built the add-in. and installed it, I get 'not a valid
office add-in' when trying to add it through Outlook.  Any ideas?

Using VS.net 2003, and using the office add-in wizard.
Author
13 Apr 2005 1:33 PM
Jay B. Harlow [MVP - Outlook]
Tony,
Do either of these KB articles help?

http://support.microsoft.com/?kbid=235009
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q316723

Hope this helps
Jay

<tony_***@yahoo.com> wrote in message
Show quoteHide quote
news:1112219247.307591.214140@g14g2000cwa.googlegroups.com...
| That worked!  thanks a lot.
|
| However, once I built the add-in. and installed it, I get 'not a valid
| office add-in' when trying to add it through Outlook.  Any ideas?
|
| Using VS.net 2003, and using the office add-in wizard.
|