You are hereCreate a Word 2003 Document Using VB.Net


Create a Word 2003 Document Using VB.Net


By hagrin - Posted on 04 August 2008

The following code will help you create a very basic Word 2003 document using VB.Net. In addition to the code below, you will need to make sure that Office is installed on the host running the application for the document to be created.

Dim word As New Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document
doc = word.Documents.Add()
Dim range As Microsoft.Office.Interop.Word.Range = doc.Range(Start:=0, End:=0)
range.Text = "Put your document's text here."
doc.SaveAs("Path and File Name")
doc.Close(True)
word.Quit()