Interop vs. Core [Not Resolved]
What is the difference between ...
VB Code:
Option Explicit On
Option Strict On
Imports Microsoft.Office.Interop
Public Class Blah
'...
'And
Option Explicit On
Option Strict On
Imports Microsoft.Office.Core
Public Class Blah
'...
I have two systems both running the same version of VS 2003 w/VSTO 2003 on XP. Only difference is one
is XP SP1 and the other is XP SP2. Now if on the system without the .Interop namespace some Office code will give
errors. I have to end up only importing just the Microsoft.Office namespace only.
Here is the code in question.
And on the working system -
http://www.vbforums.com/attachment.p...id=35769&stc=1
The XP SP1 system only shows the Core namespace.
Is there any reason that I should not import the entire Office namespace?
Thanks for any insight into this.
Re: Interop vs. Core [Resolution Pending]
But if they cant install the PIAs without having Office installed, the only give away is the end user of the
vs program. I dont think that they are giving away too much since it would really take allot of code to do anything
that would be at the level of a replacement.
:D
Re: Interop vs. Core [Resolution Pending]
Actually, one of the things you can do is run the app. It is up to you whether or not it is actually visible to the user. If it is visible, then it is just the same as starting it as normal. In this way, they are giving the whole program away (or, I suppose, the interop must launch the program).
When I was testing some of this, I kept breaking the debugger and restarting. I had a class to encapsulate the Excel work entirely, and the Dispose() method closed it. Whenever I had a problem in debugging, I restarted the app. After a little while, I looked at the system monitor, and realized I had half a dozen hidden Excel instances in memory. Had to go through and terminate them all manually.
Re: Interop vs. Core [Resolution Pending]
Ok, I installed the .NET Programm blah ... but no .Interop yet. :(
It says to run the RegAsm from the global assembly cache :confused:
Quote:
From the global assembly cache, run the RegAsm tool on the affected PIA to re-register it. For example, run RegAsm on the Office PIA (the Office PIA namespace is Microsoft.Office.Core), as follows:
%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe
%systemroot%\assembly\GAC\Office\11.0.0.0__71e9bce111e9429c\Office.dll
Re: Interop vs. Core [Resolution Pending]
I updated my office and ran the regasm from the command line.
Now I get the .Interop but when I add both references (Ofice and Outlook) the Outlook objects are not found. :(
Re: Interop vs. Core [Resolution Pending]
*BUMP* = Outlook still not found. :(
Re: Interop vs. Core [Not Resolved]
rob, unless I am doing something wrong (or not what you are looking for) I was able to set a reference to "Microsoft Outlook 11.0 Object Library" under the com tab, and then I was able to access the outlook classes.
the reference file it says it points to in the com tab is msoutl.tlb, but when you add the reference, it points to the dll in the GAC for outlooks PIA
and it imports as
Imports Microsoft.Office.Interop.Outlook
Re: Interop vs. Core [Not Resolved]
I haven't worked with Outlook, but I see the same things Kleinma sees. From your description, it really sounds like the programmability (from post #6) is not installed for Outlook. Is there a way to confirm it? Your description sounds like the problem I had before I got Excel set up right.
Re: Interop vs. Core [Not Resolved]
I also did not have to install anything to the GAC, it did it for me when I put my office CD in and did the advanced install and selected to install the PIAs
i noticed you said you had to do it manually rob?
Re: Interop vs. Core [Not Resolved]
Yes, I installed the PIAs from the Office CD and then I still had to run the RegAsm like in the article. That got the
Interop to show, but even with the reference to Outlook added it still shows "undefined" for my Outlook objects. :(
Re: Interop vs. Core [Not Resolved]
I was just re-reading some of the posts to make sure I didnt miss something and I did but it doesnt make sense.
"Imports Microsoft.Office.Interop.Outlook" make it work but at the office my system is using the "Imports Microsoft.Office.Interop"
only and that works?
Why is it different and why doesnt it recognise from just the Interop import the Outlook namespace?
Re: Interop vs. Core [Not Resolved]
Quote:
Originally Posted by RobDog888
I was just re-reading some of the posts to make sure I didnt miss something and I did but it doesnt make sense.
"Imports Microsoft.Office.Interop.Outlook" make it work but at the office my system is using the "Imports Microsoft.Office.Interop"
only and that works?
Why is it different and why doesnt it recognise from just the Interop import the Outlook namespace?
well there are 2 different COM references, one is the Office 11.0 object library and one is the outlook 11.0 one.....
I think if you reference the first one, it gives you what you say you have at work... while the second give you what I had posted..
Re: Interop vs. Core [Not Resolved]
Well now I'm even more confused. I added a reference to MS Excel and with the Imports ...Interop only I can
do Dim oWB As Excel.Workbook without errors. I should be able to do the same for Outlook but it doesnt have the PIAs I guess.
Re: Interop vs. Core [Not Resolved]
Quote:
Originally Posted by RobDog888
Well now I'm even more confused. I added a reference to MS Excel and with the Imports ...Interop only I can
do Dim oWB As Excel.Workbook without errors. I should be able to do the same for Outlook but it doesnt have the PIAs I guess.
do you see the outlook PIA in the GAC?
Re: Interop vs. Core [Not Resolved]
But if you add just the Outlook reference then it adds both the Outlook and Office references.
I'll look in the GAC.
Re: Interop vs. Core [Not Resolved]
Quote:
Originally Posted by RobDog888
But if you add just the Outlook reference then it adds both the Outlook and Office references.
I'll look in the GAC.
its weird... if i remove the office reference but leave the outlook one, it still works.. did this to test
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim OL As New Microsoft.Office.Interop.Outlook.ApplicationClass
MsgBox(OL.Version)
OL = Nothing
End Sub
im not sure if you lose any other functionality though... :confused:
Re: Interop vs. Core [Not Resolved]
I dont see the PIAs :( I re-ran the Office setup and double checked if the .NET Programmability were installed
for all products and they were. Should I install the PIA Redistributables download too?
Re: Interop vs. Core [Not Resolved]
Quote:
Originally Posted by RobDog888
I dont see the PIAs :( I re-ran the Office setup and double checked if the .NET Programmability were installed
for all products and they were. Should I install the PIA Redistributables download too?
hmmm maybe.. or can you select an uninstall of the PIAs in the office setup, and then try to install them again?
Re: Interop vs. Core [Not Resolved]
Ok, I removed the Outlook PIA and re-opened my Outlook project. Removed the reference and re-added it.
It works now but then that means I dont have PIAs for Outlook. It worked the other way (with PIA) but I'll have to
connect to work and compare the GAC? (I'm playing hooky from work today :D)
Re: Interop vs. Core [Not Resolved]
I don't know what that office one does. I remember that I added it, removed it, added it again, etc. Never did see any changes.
Re: Interop vs. Core [Not Resolved]
The Office reference is the core of the Office program. Like commandbars, toolbars, buttons, and menu items.
Re: Interop vs. Core [Not Resolved]
That explains it, I never used any of that stuff.