VB & Office 2003/2007 References
This may be the wrong forum to post this in; if so, please let me know where I should ask this question.
I'll start by saying I'm new to Visual Studio 2005 and in many ways,VB programming altogether so if I'm way off base here, please let me know.
I have designed a program that gathers data from Active Directory and dumps the information into an Excel spreadsheet. The program works fine on my development computer which is runningOffice 2007 Beta 2 and another system which also has Office 2007 on it. In the program I have referenced the COM object "Microsoft Excel 5.0 Object Library".
When I try to run the application on another computer that is running Office 2003, the program will not run. My understanding of references in VB leads me to believe the problem is caused byNOT referencing theOffice 2003 Excel COM object.
Is there a way to reference this object without actually installing Office 2003 on my developement computer?
Thanks, the answers I get out of these forums are always helpful and are a real asset to beginner programers.
-Howard
I think There is no need to reference Office 2003 (Office 2007 and 2003 are compatible : no problem in version)
And I don't understand why you reference "Excel 5.0 "
But if you send the error message I can help you more
Sorry, I made a mistake in my original post.
The object I'm referencing is the "Microsoft.Office.Interop.Excel" and "Microsoft.Office.Core" .NET objects. Not the COM objects (could this be the problem?).
Unfortunatly, there are no errors. When I run the .exe on my development workstation, the interface opens with no problem and runs perfectly. Same thing happens when I run it on another computer with Office 2007 installed. When I try to run it on computer with Office 2003 installed (by double-clicking the .exe) the windows curser shows "busy" for a couple of sections and then nothing happens. Nothing show in Task Manager during this time either.
Any thoughts?
Those are the COM references (Office.Core and Office.Interop.Excel).
Also the Excel 5 version is a good one to use if you don't need a lot of advanced features as it is compatible all the way back to Office97 (I think - that's been ages ago!).
The problem is that some versions of Office did not install the older interop assemblies. I don't remember exactly which ones, but I think that Office 2000 and Office 2002 (XP) both installed the version 5 assemblies, but 2003 did not.
If you're only concernd with supporting Office 2003 and Office 2007, change your reference from version 5 to version 11. That should fix it.
-EDIT-
Actually, the version 11 probably won't work with '07. I think sticking with the version 5 might be best for backward compatibility. I just checked a machine running Office 2003 (the only version ever installed) and the version 5 COM assembly for Excel was present. You might want to re-run the Office setup on that 2003 machine and make sure a Full install of Excel is done. It may be that the assembly wasnt' installed due to installation options. (or your app may be crashing for some other reason entirely - have you checked the event log in windows on the machine that is crashing to see if there are any relevant events?)
Ok. So now I am referencing the Excel 5.0 COM object and "importing" it into the program. Now the code written for the Office.Interop.Excel doesn't work with Excel 5.0. Can anyone point out a reference?
I'm also seeing alot of articles about "late binding" as way around this type of problems. Is that a good idea?
Thanks.
I also have this problem. If the user machine did not have a complete install of Excel 2003 (.Net Support not included), even if Excel library version 11 is referenced, the program will encounte a problem when calling Excel COM objects.
My questions: Is Visual Studio Tools for Ofice (VSTO) needs Excel 2003 to be completely installed on a client machine? Is there advantages to use VSTO to automatic Office instead of Excel COM objects. Anyone has experiences on this?
Thanks.