VBA Powerpoint:项目符号列表的格式缩进
到目前为止,我自己解决了大部分问题,只是简单地搜索已有的线程……不幸的是,这对我当前的问题不起作用,所以我想尝试一下: 我是VBA新手,最近刚开始编写一些有用的Marco,以在PowerPoint 2007上自动/简化幻灯片开发 在其中一个幻灯片中,我尝试使用预定义的项目符号列表将形状添加到幻灯片中。所有的工作都很好,除了让子弹的压痕正确。我不确定该使用哪种代码 我想做的是一方面定义项目符号和文本之间的空间,另一方面为项目符号列表的不同级别设置项目符号前的缩进 我将非常感谢您的帮助或任何链接到线程来解决这个问题 迄今开发的代码见下文:VBA Powerpoint:项目符号列表的格式缩进,vba,powerpoint,indentation,bulletedlist,Vba,Powerpoint,Indentation,Bulletedlist,到目前为止,我自己解决了大部分问题,只是简单地搜索已有的线程……不幸的是,这对我当前的问题不起作用,所以我想尝试一下: 我是VBA新手,最近刚开始编写一些有用的Marco,以在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段落格式对象上的FirstLineIndent属性设置/检索项目符号和文本之间的间距。下面给出的代码可用于在
文本框中创建项目符号和编号列表的标记文件
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
要定义项目符号和文本之间的空格,您需要设置FirstMarin和LeftMargin,请查看我的链接(但上面有一个星,因为您将面临这个问题,或者如果您有解决方案,请回答我的问题)
您是否已经有了一些正在开发的东西,可以与我们共享,而不是社区尝试从头开始创建代码?显示一些努力在So上有很大的帮助,很抱歉之前没有发布代码。刚刚更新了帖子。请不要链接到你自己的问题作为答案。尤其是当你的问题也没有答案的时候。