How to Create document using VB Script


To create a document using VB script you need a text editor and use the below code.

VB script must be ended by using .vbs

VB script runs only on Internet Explorer browser.

<script type=”text/vbscript”>
Set word = CreateObject(“Word.Application”)
Set ActiveDocument = word.Documents.Add()
ActiveDocument.TypeText “My first document”
ActiveDocument.TypeParagraph()
ActiveDocument.SaveAs(“c:sample.doc”)
</body>
</script>

Share me!