Which script would append a new line to a table in “MS Word” 2003?

会有一股神秘感。 提交于 2019-12-14 04:11:20

问题


I have this simple table in MSWord 2003:

I want to append one more line to this table:

turtle  dog rooster maple

Which VBScript commands (or set of commands) would I need here to do it automatically?

(I am using "Windows XP")


回答1:


Here are some notes.

Set wd = CreateObject("Word.Application")

wd.Visible = True

Set doc = wd.Documents.Open ("c:\docs\addtotable.doc")

Set r = doc.Tables(1).Rows.Add

aa = Split("turtle,dog,rooster,maple", ",")

For i = 0 To r.Cells.Count - 1
  r.Cells(i + 1).Range.Text = aa(i)
Next


来源:https://stackoverflow.com/questions/5056535/which-script-would-append-a-new-line-to-a-table-in-ms-word-2003

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!