SOFTWARE TESTING: Creating a Microsoft Word document

Tuesday, October 11, 2011

Creating a Microsoft Word document

Creating a Microsoft Word document  
Example:
Dim objWD

‘ Create the Word Object
Set objWD = CreateObject(“Word.Application”)

‘ Create a new document
objWD.Documents.Add

‘ Add text to the document
objWD.Selection.TypeText “This is some text.” & Chr(13) & “This is some more text”

‘ Save the document
objWD.ActiveDocument.SaveAs “c:\temp\mydoc.doc”

‘ Quit Word
objWD.Quit

‘ Release the Word

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...