|
楼主 |
发表于 2004-2-21 15:44
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
sub macro() dim adoc as word.document dim appdoc as word.application dim tabledoc as word.table dim rowdoc as word.cells dim i as integer, xpos as integer, ypos as integer xpos = 0 ypos = 0 i = 1 set appdoc = createobject("word.application") set adoc = appdoc.documents.add for i = 1 to 1 set tabledoc = adoc.tables.add(adoc.range(xpos, ypos), 8, 4) '设置表格属性 selection.tables(i).columns.preferredwidth = centimeterstopoints(2.13) selection.tables(i).columns.preferredwidthtype = wdpreferredwidthpoints selection.tables(i).columns(1).preferredwidth = centimeterstopoints(1.86) selection.tables(i).columns(2).preferredwidth = centimeterstopoints(2.42) selection.tables(i).columns(3).preferredwidth = centimeterstopoints(1.86) selection.tables(i).columns(4).preferredwidth = centimeterstopoints(2.42) selection.tables(i).rows(1).cells.merge selection.movedown unit:=wdline, count:=8 ' selection.typeparagraph next adoc.saveas app.path & "\table.doc" appdoc.quit set appdoc = nothing end sub
|
|