As seen in the article of Outlook or PowerPoint, we can create ActiveX objects which allows creating objects from other applications of the system.
We can create a Word document through VBA macro. Through an automatic analyzes of your Excel data, you can automatically write a report in the form of a Word document.
Create a Word document in VBA
To create a Word document, you must first use the CreateObject function which creates and returns a reference to an ActiveX object. This Word application has the mains properties of a document.
Sub CreateWordDocument()
'Create a Word document
Dim WordApp, WordDoc, WordLayout, WordSlide, Sh, NbShpe As Object
'Open the Word application
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
'Create a new Word Document
Set WordDoc = WordApp.Documents.Add
'Create a Text Zone
Set Sh = WordDoc.Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=150, Height:=60)
'Insert the value in A1 in the text zone
Sh.TextFrame.TextRange.Text = Range("A1")
'Modify colot text
Sh.TextFrame.TextRange.Font.Color = RGB(255, 100, 255)
End Sub
