Advertisement
tabnation

word coms

Mar 1st, 2022
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. ;v1 AHK
  2.  
  3. f1::
  4. oWord := ComObjCreate("Word.Application") ; create MS Word object
  5. oWord.Documents.Add ; create new document
  6. oWord.Selection.Paragraphs.Format.Style := "Heading 1"
  7. oWord.Selection.Paragraphs.Format.Style := "No Spacing"
  8. oWord.Selection.Font.Bold := 1 ; bold
  9. oWord.Selection.Font.Italic := 0 ; italic
  10. oWord.Selection.Font.Color := 0000 ; black
  11. oWord.Selection.Font.Size := 18 ; Font Size 18
  12. oWord.Selection.Font.Name := "Arial" ; Theme Font Arial
  13. oWord.Selection.TypeText("Tab Nation") ; type text
  14. oWord.Selection.TypeParagraph ; New line
  15. oWord.Selection.TypeText("Date: ")
  16. oWord.Selection.InsertDateTime
  17. oWord.Selection.TypeParagraph ; New line
  18. oWord.Selection.TypeParagraph ; New line
  19. oWord.Selection.TypeText("sub to me pretty please") ; type text
  20. oWord.ActiveDocument.PageSetup.Orientation := 0
  21.  
  22. oWord.Visible := True
  23. oWord.Activate
  24.  
  25.  
  26. oWord.ActiveDocument.Tables.Add(Range := oWord.Selection.Range
  27. , NumRows := 6
  28. , NumColumns := 3
  29. , DefaultTableBehavior := wdWord9TableBehavior := 0
  30. , AutoFitBehavior:= wdAutoFitFixed := 0)
  31.  
  32. _ := oWord.Selection.Tables(1)
  33. if(_.Style <> "Table Grid")
  34. _.Style := "Table Grid"
  35.  
  36. _.ApplyStyleHeadingRows := True
  37. _.ApplyStyleLastRow := False
  38. _.ApplyStyleFirstColumn := True
  39. _.ApplyStyleLastColumn := False
  40. _.ApplyStyleRowBands := True
  41. _.ApplyStyleColumnBands := False
  42.  
  43. oWord.Visible := 1, oWord.Activate ; make it visible and activate it.
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement