Get YouTube subscribers that watch and like your videos
Get Free YouTube Subscribers, Views and Likes

Excel VBA Macro: Create Word Document (and Write with Excel)

Follow
greggowaffles

Excel VBA Macro: Create Word Document (and Write with Excel). In this video, we go over how to use excel vba to open a new word doc and type text into the document. We go over how to type directly from a string in our code, and by using a string from a cell in an excel workbook.

Code:

Sub create_word_doc()

Dim objWord
Dim objDoc

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add

With objWord

.Visible = True
.Activate
.Selection.typetext ("Hello World!")
.Selection.typeparagraph
.Selection.typetext (ThisWorkbook.Sheets("Sheet1").Cells(1, 1).Text)


End With


End Sub

#ExcelVBA #ExcelMacro

posted by valeriaangz