autohotkey word com obj add multiple tables -
i try create word document 2 tables autohotkey. add 1 table , type text. try create table in same document below old table.
oword := comobjcreate("word.application") ; create ms word object document := oword.documents.add ; create new document oword.visible := 1 ; make winword visible range := oword.activedocument.range(0, 0) ; set range oword.activedocument.tables.add(range,1,2) ; add table in range oword.selection.tables(1).style := "table grid" ; set style oword.selection.tables(1).cell(1,2).range.select ; select cell oword.selection.typetext("hi hi") ; type text in selected cell oword.selection.endkey ; here couldn't able create new table oword.selection.typeparagraph range := oword.activedocument.range(0, 0) oword.activedocument.tables.add(range,10,5) oword.selection.tables(1).style := "table grid" oword.selection.tables(1).cell(1,3).range.select ; error 0x800a1735 , mentions 'cell' requested member of collection not exist ;oword.selection.typetext("hi di") oword.quit
what wrong doing here?
thank trying give solution question. able figure out 1 idea 2 hours after posting question. had add
oword.selection.movedown(5,1)
before
oword.selection.endkey
and modify
oword.activedocument.tables.add(oword.selection.range,5,5)
instead
oword.activedocument.tables.add(range,5,5)
and removed second
range := oword.activedocument.range(0, 0)
Comments
Post a Comment