Advertisement
alphauser420

word

Mar 12th, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ; Create Word application object
  2. Global $oWord = ObjCreate("Word.Application")
  3.  
  4. ; Check if Word was successfully created
  5.  
  6. If IsObj($oWord) Then
  7. ; Make Word visible (optional)
  8. $oWord.Visible = True
  9.  
  10. ; Add a new document
  11. Global $oDoc = $oWord.Documents.Add
  12.  
  13. ; Write "Hello, AutoIt!" to the document
  14. $oDoc.Range.Text = "Hello, Vishal Yadav"
  15.  
  16. ; Wait for a moment (optional)
  17. Sleep(2000)
  18.  
  19. ; Save and close the document
  20. $oDoc.SaveAs(@ScriptDir & "\AutoItWordExample.docx")
  21. $oDoc.Close
  22.  
  23. ; Quit Word
  24. $oWord.Quit
  25. EndIf
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement