Ole Automations are very powerful in Visual Basic it is a further advancement to linking objects.Using OLE automation we can control the source Document from within our application .The control can happen through the objects that are exposed by the source Document.
The Getobject method.
A Getobject method can open to excel objects and use them to create a client/Server application. The Getobject method has the following syntax:
Getobject(pathnam,class)
To open an excel object the syntax is:
Getobject("c:text.xls","Excel.sheet")
Alternate to Getobject is the createobject method which has the following syntax:
createobject(class)
The Following code helps opening an object in XLS:
Dim XLSsheet as object set XLSsheet=Getobject("text.xls","excel.sheet") XLSsheet.application.visible=true XLSsheet.cells(1,1).value=10 XLSsheet.cells(1,2).value=11 XLSsheet.cells(1,3).value="=r1c1-r1c1" msgbox(XLSsheet.cells(1,3).value)
Thus an Exposed object can be used to do the calculation rather than doing that at the client end.