PDA

Click to See Complete Forum and Search --> : [RESOLVED] How can I create a Word Document using VB/VBA?


cssriraman
Jun 14th, 2005, 08:54 AM
Hi all,

I would like to create some blank word document. Is there any way to create a word document? We can create a text file using vb. Similarly I would like to create a Word document (should be blank) using VB.

Pls let me know your comments.

Thanks,

CS.

westconn1
Jun 14th, 2005, 09:06 AM
Documents.Add

vba, will open a new document in word based on the normal template

Syntax

expression.Add(Template, NewTemplate, DocumentType, Visible)

expression Required. An expression that returns a Documents object.

Template Optional Variant. The name of the template to be used for the new document. If this argument is omitted, the Normal template is used.

NewTemplate Optional Variant. True to open the document as a template. The default value is False.

DocumentType Optional Variant. Can be one of the following WdNewDocumentType constants: wdNewBlankDocument, wdNewEmailMessage, wdNewFrameset, or wdNewWebPage. The default constant is wdNewBlankDocument.


should also work from vb, by using the wordobjectprefix

pete