24 | 05 | 2017

VisibleVisual.com | Word VB Articles

Create word document

The code below creates a new word document (including the posibility for a template use). 

Sub CreateNewWordDoc()

Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Dim txtstring As String
Dim txtreplace As String

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add '("c:\Template.dotx")

wrdApp.Selection.Text = "This new document is created thanks to visiblevisual.com. Enjoy!!"

Set wrdDoc = Nothing
Set wrdApp = Nothing

End Sub
Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2258982
Latest Articles