Excel VBA Macro: Create Word Document (and Write with Excel)
21.6 هزار بار بازدید -
2 سال پیش
-
Excel VBA Macro: Create Word
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
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
2 سال پیش
در تاریخ 1401/07/11 منتشر شده
است.
21,603
بـار بازدید شده