首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.ParagraphFormat.Alignment = wdAlignParagraphCenter不对齐

.ParagraphFormat.Alignment = wdAlignParagraphCenter不对齐
EN

Stack Overflow用户
提问于 2017-09-29 00:58:42
回答 1查看 2.6K关注 0票数 0
代码语言:javascript
复制
Do While Z <= partcount - 3
    With wordapp.Documents(worddoc).Tables(2)
        With .Cell(Z, 1)
            With .Range
                .ParagraphFormat.Alignment = wdAlignParagraphCenter
                With .Font
                    .Size = 11
                    .Bold = False
                    .ColorIndex = 1
                    .Name = "Arial"
                End With
            End With
        End With
    End With
    Z = Z + 1
 Loop

宏将一直运行,但单元格不会与中心对齐。所有其他的格式化works...probably都缺少一些非常基本的东西,我总是会遇到这种情况。

EN

回答 1

Stack Overflow用户

发布于 2017-09-29 02:10:57

我想通了。因为我正在从excel中创建一个word实例(我在问题中忽略了这一点),所以问题出在word的预定义属性上。新代码:

代码语言:javascript
复制
Do While Z <= partcount + 1
    With wordapp.Documents(worddoc).Tables(2).Cell(Z, 1).Range
        .ParagraphFormat.Alignment = 1
        With .Font
            .Size = 11
            .Bold = False
            .ColorIndex = 1
            .Name = "Arial"
        End With
    End With
    Z = Z + 1
Loop

谢谢!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46474586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档