new reference library to old refrence lib??

Signo.X

Well-known member
Joined
Aug 21, 2006
Messages
76
Location
Australia
Programming Experience
1-3
i have developed a large solution using vs.net 2005 in vb.net running on MS XP operating system .. the solutions contains multiple projects..


in one of the projects i have few functionality to manipulate an Excel and word document..so i had to add a COM refrence to my project
"MS office word and excel object library and i think it was 10.5 ..
so i can access the 'Microsoft.Office.Interop.Word name space..

i tried to run the same project on another machiene that has vs.net 2003 and an older version of windows and MS office...

but then i get the following error ..

reference to Lib MS office word and excel object library 10.5 doesnt exist or maybe is not installed on the machiene..try to update MS office or vs.net ..'Microsoft.Office.Interop.Word'
or some thig like that..


I'm so frustrated..

any ideas?

~signo.X :confused: :mad: :eek:
 
Strong/early binding to that office library requires that same version to be installed also on every target machine, the error message is pretty explicit. The other option is late binding and specific targeting of objects compatible between different office library versions, but it's hard coding and not recommended. So accept how things work, and develop for specific office version, if you need to deploy to machines with different office versions it may be less work to make a copy of the project and re-reference to different office lib and possible recode where you have to in order to have two strong versions available.
 
ok, i'll try that .. i hope it works though..

Thanks..what a day full of frustration after i thought i completed my first .NET project..
thats why ... java and only java..is always my first personal choice when it comes to developing softwares..
:(
 
Here is an article with code examples describing the two different binding methods for the office automation libraries, just so you can get the inside of it, http://support.microsoft.com/kb/304661/

Javascript is good for client-side scripts in webpages and perhaps if you need to script desktop automation, but else I'd stick to .Net.
 
Thanks John ,
that really helped,.

one more question regarding the late binding , i dont have a problem to do the following .. :

Dim objApp As Object
Dim objBook As Object
Dim objBooks As Object
Dim objSheets As Object
Dim objSheet As Object
Dim range As Object

' Instantiate Excel and start a new workbook.
objApp = CreateObject("Excel.Application")

etc...

but when it come to declaring excel charts as object and try to use thier properties or methods..i CANOT do the following :

Dim oChart AsObject

With oChart
'set data range for chart
Dim chartRange As object

.SetSourceData(chartRange)

'set draw chart i.e column wise or row wise
.PlotBy = XlRowCol.xlColumns

'set data lables for bars
.ApplyDataLabels(XlDataLabelsType.xlDataLabelsShowNone)



that happenes basically cuz im using late binding and i took off the refernce library 'MS Excel object library.. so it doesnt know those properties???

do i need to exclude the refrence library 'MS Excel object library' from the project ? or keep it ?
any ideas?
 
Yes, that's late object bindings disadvantange, you have to know all properties and methods and parameters and write them manually without any help from editor/intellisense that only know it as a Object. The advantage as you understand is if you write code that is compatible for several office library versions the deployed app will work for all those that have any of those Office versions installed. Perhaps you could also start develop strong for code help, then make a copy that you replace with Object and late binding. (off course you still have to check everything for version compability)
 
Thanks ,


any idea how can i fix this ?

With oChart
'set data range for chart
Dim chartRange As object

.SetSourceData(chartRange)

'set draw chart i.e column wise or row wise
.PlotBy = XlRowCol.xlColumns

'set data lables for bars
.ApplyDataLabels(XlDataLabelsType.xlDataLabelsShowNone)

end with

it doesnt recognise some of the properties that's supported by the Excel.chart obejct... how to i fix this poblem ? and how do i know what other peoperties/functions that is compatible with that late binding ?
 
Back
Top