Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions
Targetting Multiple Office Versions Targetting Multiple Office Versions
Targetting Multiple Office Versions
Go Back  Xtreme Visual Basic Talk > > > Targetting Multiple Office Versions


Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2005, 08:00 AM
wayneph's Avatar
waynephTargetting Multiple Office Versions wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default Targetting Multiple Office Versions


This project has been put on hold, but I'd kind like to see what I need to do to accomplish this.

Right now my company has some users on Office 2000 and others on Office 2003. I'm trying to write something in .NET that will allow me to Automate Outlook in both versions with out having to duplicate all of my code.

I have 2003 on my machine. If I add a reference to it, and use that for the Interop classes, it probably won't work on machines that have Office 2000. Would the converse work? If I develop for 2000, would it work in 2003?

In VB6 I could use Late Binding to pick up the appropriate version automagically. Is there a .NET way to gracefully return the correct object without having to write code for each version.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #2  
Old 03-18-2005, 01:56 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hey Wayne,

I'm really not around right now, as you know... (I'm actually in the middle of a move today!) Anyway, my point is that I might not be able to post a follow-up to this for many, many days if you reply...

The best "one shot" to handle this is to use Late Binding. You can do this in VB.Net, but it requires 'Option Strict Off'. So it's best if you confine your Late Binding stuff to a single tabbed Document (I don't even know what to call these files in .Net ) and let the rest of your project that is using 'Option Strict On' remain that way.

I hate Late Binding though, I just do... So my thinking here is that you might have to have a separate Install for Office 2000, 2002, 2003. If possible, you should delevelop on O'2000, that way you won't use any commands that only exist on the later versions... Although, I don't know Outlook well, so there may be Security issues in 2002/2003 that prevent certain actions avail in 2000??? (Pure guesswork on my part; I could be way off, I never use Outlook.)

Anyway, these are MS Office Issues, not .Net issues really. The .Net aspect is that a separate local Primary Interop Assembly (PIA) will be created for each version automatically. For 2003 there is a PIA in the GAC you should be referencing, and 2002 has a downloadable version. But 2000 does not have one provided by MSFT, and so you simply reference Outlook 200 and a PIA is automatically created for you in your bin\ folder(s), as would be with any ActiveX DLL or OCX would.

So, in short, for 2000 you need to provide this PIA with your install. For 2002/2003 you should be looking to reference the PIA in the GAC. Your install routine would have to check which version of MS Office is installed and react accordingly.

Then again, using CreateObject() and 'Option Strict Off' is starting to sound tempting... Hmm...

Hope this helps!
(And I'll get back then I can...)

-- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #3  
Old 03-21-2005, 09:50 AM
wayneph's Avatar
waynephTargetting Multiple Office Versions wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Thanks for the help Mike. Since I'm mostly doing web apps, I haven't had to (gotten to) play with some of the more "advanced" .NET stuff like playing with the GAC. I think I'm starting to agree that just using Late Binding may be the easiest way to approach this.

For the immediate needs, they were just trying to send eMail, so I talked them into using SMTP so that I didn't have to worry about it. The downside is that they don't get the message in Sent Items, but I'm sending them a confimation message when the email goes out, so everyone is happy right now. (we'll see how long it lasts. )
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions Targetting Multiple Office Versions
Targetting Multiple Office Versions
Targetting Multiple Office Versions
 
Targetting Multiple Office Versions
Targetting Multiple Office Versions
 
-->