2

直到现在我自己解决了我的大部分问题/问题,只是搜索已经存在的线程......不幸的是这对我当前的问题不起作用,所以我想我试一试:

我是 VBA 新手,最近才开始编写一些有用的 marcos 来自动化/简化 PowerPoint 2007 上的幻灯片开发。

在其中一个中,我试图将形状添加到带有预定义项目符号列表的幻灯片中。一切正常,除了让子弹的缩进正确。我不确定要使用哪个代码...

我想要做的是一方面定义项目符号和文本之间的空间,另一方面为项目符号列表的不同级别设置项目符号之前的缩进。

我非常感谢您的帮助或任何指向解决此问题的线程的链接。

到目前为止开发的代码见下文:

Sub PhaseWiz1Row2Phases()

Dim sld As Slide
Dim SlideIndex As Integer
Dim row1 As Shape

'###Only apply command to currentlty viewed slide###

'set the index number of the currently viewed slide as the variable "SlideIndex"
SlideIndex = ActiveWindow.View.Slide.SlideIndex
'set sld as the current slide
Set sld = ActivePresentation.Slides(SlideIndex)


'###Add and configure shapes to currently viewed slide###

'add first column to the currently viewed slide
 Set row1 = sld.Shapes.AddShape(msoShapeRectangle, _
     Left:=35.999, Top:=195.587, Width:=308.971, Height:=120)

        'configure column
        row1.Fill.Visible = msoFalse
        row1.Line.Visible = msoTrue
        row1.Line.Weight = 1#
        row1.Line.ForeColor.RGB = RGB(0, 40, 104)

        'Add and configure text
        row1.TextFrame.TextRange.Text = "Headline" _
            + Chr$(CharCode:=13) + "Text" + Chr$(CharCode:=13) + "Text" _
            + Chr$(CharCode:=13) + "Text" + Chr$(CharCode:=13) + "Text"

        row1.TextFrame.TextRange.Font.Size = 14
        row1.TextFrame.TextRange.Font.Name = "Verdana"
        row1.TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignLeft
        row1.TextFrame.VerticalAnchor = msoAnchorTop


        row1.TextFrame.TextRange.Paragraphs(3).IndentLevel = 2
        row1.TextFrame.TextRange.Paragraphs(4).IndentLevel = 3
        row1.TextFrame.TextRange.Paragraphs(5).IndentLevel = 4

            With row1.TextFrame.TextRange.Characters(1, 8)
                            .Font.Color.RGB = RGB(0, 174, 239)
                            .Font.Bold = msoTrue

            End With

            With row1.TextFrame.TextRange.Characters(9, 16)
                            .Font.Color.RGB = RGB(0, 40, 104)
                            .Font.Bold = msoFalse

            End With

            With row1.TextFrame.TextRange.Characters(10, 0)
                            .ParagraphFormat.Bullet.Character = 8226
                            .ParagraphFormat.Bullet.RelativeSize = 0.7

            End With

            With row1.TextFrame.TextRange.Characters(15, 0)
                            .ParagraphFormat.Bullet.Character = 45
                            .ParagraphFormat.Bullet.RelativeSize = 1.2
                            '.Paragraphs(3).IndentLevel = 2

            End With

            With row1.TextFrame.TextRange.Characters(20, 0)
                             .ParagraphFormat.Bullet.Character = 43
                             '.Paragraphs(3).IndentLevel = 2
            End With

            With row1.TextFrame.TextRange.Characters(25, 0)
                             .ParagraphFormat.Bullet.Character = 46
            End With

结束子

4

3 回答 3

0

ParagraphFormat对象上的FirstLineIndent属性设置/检索项目符号和文本之间的间距。

于 2015-03-31T14:16:41.937 回答
0

要定义项目符号和文本之间的空间,您需要设置 FirstMarin 和 LeftMargin,请参阅我的链接(但上面有一个星号,因为您将面临这个问题,或者如果您有解决方案,请回答我的问题) 什么是实现项目符号功能的正确方法在 powerpoint 中

于 2020-01-14T07:59:32.640 回答
0

下面给出的代码可用于在textframe.

          For oPara = 1 To oShape.TextFrame.TextRange.Paragraphs.Count
            Select Case oShape.TextFrame.TextRange.Paragraphs(oPara).ParagraphFormat.Bullet.Type
              Case ppBulletMixed, ppBulletPicture, ppBulletUnnumbered   'Check if the paragraph is bulletted'
                Select Case oShape.TextFrame.TextRange.Paragraphs(oPara).IndentLevel
                  Case 1
                    Print #iFile, "* " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case 2
                    Print #iFile, "  * " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case 3
                    Print #iFile, "    * " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case 4
                    Print #iFile, "      * " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case Else
                    Print #iFile, "* " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                End Select
              Case ppBulletNumbered 'Check if the paragraph is numbered'
                Select Case oShape.TextFrame.TextRange.Paragraphs(oPara).IndentLevel
                  Case 1
                    Print #iFile, "1. " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case 2
                    Print #iFile, "  1. " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case 3
                    Print #iFile, "    1. " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case 4
                    Print #iFile, "      1. " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                  Case Else
                    Print #iFile, "1. " & oShape.TextFrame.TextRange.Paragraphs(oPara).Text;
                End Select
              Case ppBulletNone 'extract unbulletted paras as is'
                Print #iFile, vbCrLf & oShape.TextFrame.TextRange.Paragraphs(oPara).Text & vbCrLf;
              Case Else
                Print #iFile, vbCrLf & oShape.TextFrame.TextRange.Paragraphs(oPara).Text & vbCrLf;
            End Select
          Next oPara
于 2016-12-17T05:16:59.333 回答