All commands in Word are directed to the active document, which may be changed in code. It is recommended to use named arguments, as the argument sequences are recorded incorrectly in some documentation, including the type library and what the recorder writes to macros.
Sub runWord()
' demonstrating the use of OLE Automation
' to manipulate Word
' create local variables
Dim objWordApp As Object
' create the app object and assign the reference
Set objWordApp = CreateObject("Word.Application")
' manipulate the app object
' insert appropriate VBA code here to manipulate Word object
' close Word
objWordApp.Quit
' delete the object
Set objWordApp= Nothing
End Sub
See Also
OLE automation example using the Microsoft Word object