Writing and formatting text
It's all very well to know how to open Word with a new document available. However, we need more than this. A heading for the new document would be a good start, but that is still not enough. Formatting the heading is also necessary, and will round it off professionally.
In this recipe, we will be writing and formatting text.
Getting ready
Make sure Word_Interaction.xlsm
is still open, and that the VBA Editor is active.
How to do it…
These are the steps to enter and format text in Word:
- To add text to a Word document via Excel, add the following line of code:
Sub CreateWordDoc()     Dim wdApp As Word.Application     Set wdApp = New Word.Application     With wdApp         .Visible = True         .Activate         .Documents.Add    ...