Well, Kiran, the question you pose here and with your previous posting are
big questions, and not easily answered. Here are some starters:
1. The source code for Word and other Microsoft Office products are
proprietary to Microsoft and are not available to the public. I really
don't think that's what you really want with your question.
2. One of the beautiful things about Microsoft Office is that although the
source code is not available, the products are extensible, and Microsoft has
provided a way for you to get at much of the functionality of each product
through Visual Basic for Applications, an extension of VB designed for and
shipped with each Office product. This functionality is also available
through Microsoft VB and C.
3. Each Office product, like Word and Excel, has its own "object model"
that is exposed and available in the VBA programming environment. This
object model makes objects, like documents, cells, paragraphs, etc. and
their corresponding methods (commands you can use against the object) and
properties (attributes of the objects) available to the programmer. Pretty
much anything that you can do with an Office application via a keyboard and
mouse you can also do via programming against this object model. You can,
for example, create a new Word document, set the document dimensions, spell
check the document, count the words in a document, etc. from a VB program.
(A big caveat... the user running your VB program will still need a license
for Word, which must be installed on their computer. Writing a VB program
should not be considered as a replacement for the original Office product.)
Your question as to how to do this is too big for the group listserve. My
suggestion is that you begin by going to your local bookstore and invest
some time in looking through some of the books that talks about the Office
object model and how to use and manipulate it.
Hope this helps.
Stu