您的位置:程序门 -> vb -> vba



怎样使excel中的内容按照word中的对齐方式对齐?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


怎样使excel中的内容按照word中的对齐方式对齐?
发表于:2007-07-30 15:07:31 楼主
我用代码把word中的内容复制到excel中后,我想把excel中的内容按照word中的对齐方式对齐,比如:在word中标题是居中的,复制到excel后是左对齐的.不知道如何用代码实现,请多指教,谢谢!!!
发表于:2007-07-30 16:45:021楼 得分:0
你从word拷贝的时候,可以取得word的格式吗?
发表于:2007-07-30 16:45:422楼 得分:0
比如   word中标题是居中的,你放到excle的时候,还能知道word中标题是居中的吗?
发表于:2007-07-31 11:43:403楼 得分:0
你从word拷贝的时候,可以取得word的格式吗?比如   word中标题是居中的,你放到excle的时候,还能知道word中标题是居中的吗?

回答:在vb中可以取得word文字的大小,加粗.对齐方式我没有取到,想问问其他人能否取到?
发表于:2007-07-31 17:27:204楼 得分:0
sub   macro1()
dim   par   as   paragraph,   index   as   long,   n   as   long
for   each   par   in   activedocument.paragraphs
index   =   par.range.paragraphformat.alignment
n   =   n   +   1
if   index   =   wdalignparagraphcenter   then   debug.print   "第 "   &   n   &   "短对齐方式:居中 "
if   index   =   wdalignparagraphleft   then   debug.print   "第 "   &   n   &   "短对齐方式:左对齐 "
if   index   =   wdalignparagraphright   then   debug.print   "第 "   &   n   &   "短对齐方式:右对齐 "
if   index   =   wdalignparagraphjustify   then   debug.print   "第 "   &   n   &   "短对齐方式:两端对齐 "
next
end   sub


快速检索

最新资讯
热门点击