VBA Powerpoint:项目符号列表的格式缩进

时间:2015-03-20 12:38:12

标签: vba powerpoint indentation powerpoint-vba bulletedlist

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

我是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

End Sub

3 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

下面给出的代码可用于在protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \App\Http\Middleware\CheckUserAge::class, // <------- add here too ], ]; 中创建项目符号和编号列表的降价文件。

textframe

答案 2 :(得分:0)

要定义项目符号和文本之间的空间,您需要设置FirstMarin和LeftMargin看到我的链接(但是上面有一个星号,因为您将来会面对此问题,或者如果您有解决方案,请回答我的问题) What is the correct way to implement bullet functionality in powerpoint Autoshape