> Is there an example showing how to do this.
>
[quoted text clipped - 8 lines]
> thank you
> Mark
Ypu camn't avoid this. You need a separate dll for each version of Office
that you are targeting. However, you don't need two projects. One project
with two solutions will do the trick. The only way to avoid this is to use
VBA6.
I assume your project is a COM add-in.
/Fredrik
Fredrik,
Do you mean one project with two solutions in VBA6 or .Net VS?
Jonathan
Fredrik Wahlgren - 06 Jan 2005 23:04 GMT
> Fredrik,
>
> Do you mean one project with two solutions in VBA6 or .Net VS?
> Jonathan
In mean two solutions in VS .NET. Supporting two versions of Office is less
of an issue in VB6.
Can you tell me a little more about your project?
/Fredrik
sfong@gt.com.au - 06 Jan 2005 23:46 GMT
Fredrik
As you already know from other post, I am developing a Addin for
MSProject using .Net and it is going to support 2002 and 2003. They
require different versions of office PIA. If you are saying I need two
phyical VS.Net solution files to compile to against different versions
of MSProject then that is not what I want. I am looking for a single
VS.Net solution file to compile both, of course not at the same time. I
need different VS.Net configuration in a single solution, such as
DEBUG1 and DEBUG2 in configuration manager. In the source code, it need
#if to determine which version that I am compiling with. This is the
idea.
Jonathan
Fredrik Wahlgren - 07 Jan 2005 15:36 GMT
> Fredrik
>
[quoted text clipped - 10 lines]
>
> Jonathan
You need two solutions but they will be hosted by a single project. This
way, you can get 4 add-ins. 2 release versions and 2 debug versions. Am I
missing something? You don't have to build all of these at the same time if
you don't want to. I assume that debug1 is for MSProject 2002 and debug2 is
for MSProject 2003.
/Fredrik
/Fredrik
sfong@gt.com.au - 08 Jan 2005 05:56 GMT
Yes, that is right. Thanks for the help.
Jonathan
> Ypu camn't avoid this. You need a separate dll for each version of
> Office that you are targeting. However, you don't need two projects.
> One project with two solutions will do the trick. The only way to
> avoid this is to use VBA6.
The following code will open excel and add a new workbook. It works
for both Office 2000 and Office 2003 (only have access to those
versions currently).
There may be instances in the object model where versions are not
compatible, but for most of the basic functions they are compatible.
For example I also have New Email, New Task, and New Appointment
working for Outlook 2000 and 2003 as well as Mail Merge and Opening of
Word documents in 2000 and 2003. This is using the same application
executable on different machines. You should only need separate
assemblies if you are linking to the managed office assemblies, and
they are only available for Office XP and Office 2003. I have to
target Office 97 onwards unfortunately.
Type _ExcelType = Type.GetTypeFromProgID("Excel.Application");
System.Object _ExcelObj = Activator.CreateInstance(_ExcelType);
object[] args = new object[1];
args[0] = true;
_ExcelObj.GetType().InvokeMember("Visible", BindingFlags.SetProperty,
null, _ExcelObj, args);
System.Object _BookObj = _ExcelObj.GetType().InvokeMember("Workbooks",
BindingFlags.GetProperty, null, _ExcelObj, null);
System.Object _Document = _BookObj.GetType().InvokeMember("Add",
BindingFlags.InvokeMethod, null, _BookObj, null);
cheers,
Jeremy