Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. oWord := ComObjCreate("Word.Application") ; create MS Word object
  2. Document := oWord.Documents.Add ; create new document
  3. oWord.Visible := 1 ; Make winword visible
  4. range := oWord.ActiveDocument.Range(0, 0) ; Set Range
  5. oWord.ActiveDocument.tables.Add(range,1,2) ; Add table in range
  6. oWord.Selection.Tables(1).Style := "Table Grid" ; set style
  7. oWord.Selection.Tables(1).Cell(1,2).Range.Select ; select a cell
  8. oWord.Selection.TypeText("Hi hi") ; type a text in selected cell
  9. oWord.Selection.EndKey ; from here I couldn't able to create a new table
  10. oWord.Selection.TypeParagraph
  11. range := oWord.ActiveDocument.Range(0, 0)
  12. oWord.ActiveDocument.tables.Add(range,10,5)
  13. oWord.Selection.Tables(1).Style := "Table Grid"
  14. oWord.Selection.Tables(1).Cell(1,3).Range.Select ; get error 0x800A1735 and it mentions 'Cell' The requested member of the collection does not exist
  15. ;oWord.Selection.TypeText("Hi di")
  16. oWord.Quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement