[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I add the component for EXcel 2010 to a windows application when the user only has Excel 2007 installed?

Posted on 2012-08-12
10
Medium Priority
?
377 Views
Last Modified: 2012-08-14
I have a windows app that I had to move to another computer that has Excel 2010 installed on it.  I upgraded the references , so the application works.  When the application is installed on a computer with Excel 2010, it installed properly, but now I am trying to install it on a computer with only Excel 2007.  Is there a way to add the component to a machine within the package?  Can you give me detailed instructions, since I've never done this.
Thanks in advance.
Linda
0
Comment
Question by:LenTompkins
  • 5
  • 4
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 38287498
The approach that I have taken in the past with this issue, is to create different assemblies that have the correct references for the interop libraries.  This is not something that I have done for quite a while, so I can't give you detailed information.  I can, though, give you a nudge in the right direction.
0
 

Author Comment

by:LenTompkins
ID: 38287586
The message I am getting is Unable to install or run application.  The application requires that assembly Microsoft.vbe.Interop Version 14.0 be installed in the Global Assembly cache first.  I had added Microsoft.vbe.Interop version 12 to the application which I didn't need before, but I am still getting the same message.  

I had tried moving the application to a machine that does have Excel 2007 and VS installed.  I deleted the references to Microsoft.Office.Interop.Excel and tried to add the two resources that old versions had.  Microsoft.Office.Interop.Excel and Microsoft.Office.Core.  I could not find Microsoft.Office.Core.  Is it contained in any other component?  
Any assistance is greatly appreciated.
0
 

Author Comment

by:LenTompkins
ID: 38287968
When I moved the application to the machine with Excel2007 and added the Micorsoft.vbe.Interop version 12, I was getting an error stating that the Interop was referenced twice.  When I expand the references, I do not see it there twice, but I did see VBIDE.  Could this be where I am getting a duplicate reference and if that is the case, can I delete the VBIDE and put Microsoft.vbe.Interop in it's place?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 38288303
1) You don't need the VBIDE reference, although it is added when you add a reference to the Microsoft Office COM library.

2) Do you have both Office versions installed on the development machine?

3) Do you have multiple projects for each version?

4) The build output for the project needs to point to different folders for each project.
0
 

Author Comment

by:LenTompkins
ID: 38288502
1.  Thanks I will take out the VBide reference and add the Microsoft.vbe.Interop version.
2.  I do not have both versions installed on my development machine.  I know that Excel can't have two different versions on the same machine.
3.  I have created mutiple projects for each version, but I am unclear what needs to be in the 2007 Excel version.  
4.  I have the publish output for the project pointing  to different folders, but not the build output.  Since each project is in its own folder, won't the build output be seperate?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 38289312
1) You don't need the Microsoft.vbe.Interop either.

2) It gets a little tricky if you don't have multiple versions installed on the same machine.  The trick is to get the assemblies to load according to the version requirements.

3) Are you using source control, such as Team Foundation Server or Visual Source Safe?

4) If you have source control, do you have the option of multiple development machines connecting to the source code repository?
0
 
LVL 27

Expert Comment

by:MikeToole
ID: 38289761
An alternative is to use late binding via the Dynamic data  type. then you don't need any reference to interop.

Type type = System.Type.GetTypeFromProgID("Excel.Application");
dynamic xlApp = Activator.CreateInstance(type);

You won't get any intellisense sand there's no comppile-time checking, but it removes the version depedency.

You can get intellisense during development by using Interop, then convert the definitions to dynamic.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 38290394
Late-binding is a process fraught with danger.  If you go down that road, I would suggest creating a very stringent unit test framework.

There is no perfect approach--each has it's own problems.  I prefer the compile-time checking that you get from early-binding.
0
 

Author Comment

by:LenTompkins
ID: 38293489
I had to go between two machines, but I grabbed an old version that used Excel 2007, moved all of the forms , etc to the old version from the new version, had to add System.DirectoryServices and then moved it back to the machine that had Excel 2007 on it.  I complied and published an application and it worked.  Thanks
0
 

Author Closing Comment

by:LenTompkins
ID: 38293504
I thought I may have to do this, but your comments reinforced the concept.  I appreciate it.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Simple Linear Regression
Loops Section Overview

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question