Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Create Word application object
- Global $oWord = ObjCreate("Word.Application")
- ; Check if Word was successfully created
- If IsObj($oWord) Then
- ; Make Word visible (optional)
- $oWord.Visible = True
- ; Add a new document
- Global $oDoc = $oWord.Documents.Add
- ; Write "Hello, AutoIt!" to the document
- $oDoc.Range.Text = "Hello, Vishal Yadav"
- ; Wait for a moment (optional)
- Sleep(2000)
- ; Save and close the document
- $oDoc.SaveAs(@ScriptDir & "\AutoItWordExample.docx")
- $oDoc.Close
- ; Quit Word
- $oWord.Quit
- EndIf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement