By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,582 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,582 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

<to******@yahoo.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.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

Nov 21 '05 #2

P: n/a
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.

Nov 21 '05 #3

P: n/a
Tony,
Do either of these KB articles help?

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

Hope this helps
Jay

<to******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.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.
|

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.