实现进度条功能

发布于 2025-01-14 12:12:41 字数 517 浏览 4 评论 0原文

    Sub demo()
    Dim oPara As Paragraph
    For Each oPara In ActiveDocument.Paragraphs
           If oPara.style = "Body text" Then
               With oPara.Format
                    .LineSpacingRule = wdLineSpaceSingle
                    .SpaceAfter = Word.Application.LinesToPoints(0)
                    .SpaceBefore = Word.Application.LinesToPoints(0)
               End With
        End If
    Next oPara
End Sub

vba代码将每个带有“正文文本”样式的段落设置为某种格式,但我想添加 进度条,当代码运行时,进度条显示:当前页数/总页数?

    Sub demo()
    Dim oPara As Paragraph
    For Each oPara In ActiveDocument.Paragraphs
           If oPara.style = "Body text" Then
               With oPara.Format
                    .LineSpacingRule = wdLineSpaceSingle
                    .SpaceAfter = Word.Application.LinesToPoints(0)
                    .SpaceBefore = Word.Application.LinesToPoints(0)
               End With
        End If
    Next oPara
End Sub

The vba code is set every paragraphs with “ Body Text” style to some format,but I want to add
progress bar ,when the code run ,progress bar shows: current pages /total pages?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天涯沦落人 2025-01-21 12:12:41

正如蒂莫西所说:

Sub Demo()
With ActiveDocument.Styles(wdStyleBodyText).ParagraphFormat
  .LineSpacingRule = wdLineSpaceSingle
  .SpaceAfter = 0
  .SpaceBefore = 0
End With
End Sub

不需要循环,因此不需要进度条。

As Timothy says:

Sub Demo()
With ActiveDocument.Styles(wdStyleBodyText).ParagraphFormat
  .LineSpacingRule = wdLineSpaceSingle
  .SpaceAfter = 0
  .SpaceBefore = 0
End With
End Sub

No looping required and, hence, no need for a progress bar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文