Com Model Explanation
Com Model Explanation
As an example consider Microsoft Outlook Application. You can open Outlook and then
send mails, manage appointments & do many other things. Now what if you want to do
all these tasks through code ( i.e. without manually opening Outlook). This is the
situation where you would need COM.
Microsoft Outlook exposes all its functionalities in form of certain methods and
properties. You can access these methods using any programming language like C#, VBA,
VBScript etc and directly interact with MS Outlook.
Distributed Component Object Model is an extension of the Component Object Model (COM) that allows COM
components to communicate across network boundaries.
Traditional COM components can only perform interprocess communication across process boundaries on the same machine. DCOM
uses the RPC mechanism to transparently send and receive information between COM components (i.e., clients and servers) on the
same network.
Remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a subroutine or procedure
to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding
the details for this remote interaction.
There are Object models for Excel,word,power point,File system object and Dictionary object and so on.
Reference
To develop solutions that use Microsoft Office Excel, you can interact with the objects provided by the Excel
object model.Using Excel object,we can interact with Workbooks,worksheets,cells in excel sheet through
scripting
Below code snippet illustrates the Creation excel file,entering some data and saving it
'Create Excel Object
Set excel=createobject("excel.application")
'Make it Visible
excel.Visible=True
'Add New Workbook
Set workbooks=excel.Workbooks.Add()
'Set the value in First row first column
excel.Cells(1,1).value=" Automation365.blogspot.com "
'Save Work Book
workbooks.saveas"D:\Automation365.xls"
'Close Work Book
workbooks.Close
'Quit from Excel Application
excel.Quit
'Release Variables
Set workbooks=Nothing
Set excel=Nothing
n File System Object:
When writing scripts, it's often important to add, move, change, create, or delete folders (directories) and files
on the Web server.
It may also be necessary to get information about and manipulate drives attached to the Web server.Scripting allows you to process
drives, folders, and files using the FileSystemObject (FSO) object model
Below code snippet creates text file,enters some text and saves it
' Declare variables
Dim fso, MyFile
To use a COM object in a script, you must first create an instance of the object. You can do this by calling the CreateObject
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\ Automation365.txt", True)
MyFile.WriteLine("we are from Automation365 ")
MyFile.Close
Set fso = Nothing