Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

OLE Automation Example Using the Microsoft Word Object

OLE Automation Example Using the Microsoft Word Object

  • Last UpdatedJul 18, 2023
  • 1 minute read

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

Using OLE Automation Objects

Related Links
TitleResults for “How to create a CRG?”Also Available in