TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
C# Microsoft.Office.Interop
Nov 27 2012 5:35 PM
In a C# 2008 application, I am getting the following error message:"
Could not resolve this reference. Could not locate the assembly "Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors."
I would like to ask the following questions:
1. The workstation I am installing the excel.interop has excel 2010 installed on it. However the reference points to excel 2007.
Thus can you tell me which interop I want to use excel 2007 or excel 2010?
2. When I downloaded the interop for 2010, i tried to add the assembly reference to the visual studio 2008 solution file. However from the references in solution explorer, I selected add references and then I selected the .net tab. I could not find the interop reference.
Thus can you tell me if I am looking in the wrong place to add the reference? if not, do i need to need to work with interop for 2007? What do you suggest I do?
Reply
Answers (
3
)
0
Vulpes
0
96k
2.5m
Nov 28 2012 7:02 PM
I'd check the Office 14 folder to see whether you can find Microsoft.Office.Interop.Excel.dll in there. If it's there, then copy it to the same folder as your application so it can find and load it at run time
If it's not there, then I'd download the Office 14 PIAs using the link I gave earlier, locate the one for Excel and copy it your application's folder.
I think it's best to stick with the Excel 14 PIA on the workstation as this is the version which corresponds to Excel 2010. However, it should be backwards compatible with the Excel 2007 PIA (v12) as mentioned above.
Accepted Answer
0
dc
0
663
0
Nov 28 2012 12:39 PM
Thank you very much for your suggestions!
However, I would like to ask the following additonal questions:
1. I originally downloaded the interop file from the link:
http://www.microsoft.com/en-us/download/details.aspx?id=18346.
2. The readme directions said to do the following:
a. Double-click the O2007PIA.msi file and I did this. b. Execute "msiexec.exe /i O2007pia.msi". I then went to a command prompt, changed the directory path of where the the msi installer was located at above. I then hit the enter key.
c. I did not reboot (restart) the workstation.
d. I went to the control panel and found that the interop for 2007 was installed.
e. I then went to solution explorer, right clicked on references and selected the .net and com tabs. I would not find a reference for this 2007 interop.
f. I then went to solution explorer, right clicked on references and selected I sent to the following directory path C:\Program Files (x86)\Microsoft Office and found folfers for office11, office12, and office14.
I do not know what reference to attach to this application.
Thus can you tell me if I should proceed somehow with what I am trying right now and/or should I
try downloading the Office PIAs v14.0 to the workstation and see if it will run OK then
from the following location as you have suggested:
http://www.microsoft.com/en-us/download/details.aspx?id=3508?
By the way this is just a 'test' workstation I am using it is just setup for my general testing.
Thus can you tell me what you think the best way to proceed is? If I download what you suggested, can you tell me where and how I will find the interop 2007 that I need to attach to this application?
0
Vulpes
0
96k
2.5m
Nov 28 2012 11:03 AM
Well, it sounds like the workstation you're installing your application on doesn't already have the Excel Object Library v14.0 (Microsoft.Office.Interop.Excel.dll) installed because, if it did, then it should look for that if v12.0 is not present.
It ought then to work fine as the PIAs should be backwards compatible i.e. an application developed against Excel 2007 should run fine on a machine with Excel 2010 installed.
I'd try downloading the Office PIAs v14.0 to the workstation and see if it will run OK then:
http://www.microsoft.com/en-us/download/details.aspx?id=3508
Incidentally, I wouldn't try downloading these onto the development machine as they probably won't work with Excel 2007 and it's better in any case to develop to the 'lowest' version of the Office PIAs so that your app will work on machines with that or later versions installed.
access denied error
refreshing problem