这是我正在使用的代码,但不起作用,属性
LeftIndent
不存在于 textRange
对象中。
Sub Puce_2nd_level()
Dim slide As slide
Dim shape As shape
Dim textRange As textRange
If Not ActiveWindow.Selection.textRange Is Nothing Then
Set textRange = ActiveWindow.Selection.textRange
With textRange.ParagraphFormat
.LeftIndent = 3 '<-- This function doesn't exist
.SpaceAfter = 3
.Alignment = ppAlignLeft
'.FirstLineIndent =
End With
Else
MsgBox "Veuillez sélectionner le texte auquel vous souhaitez ajouter une puce.", vbExclamation
End If
End Sub
您需要使用属性
TextRange2
而不是 TextRange
,它具有 LeftIndent
-属性:
Sub Puce_2nd_level()
Dim slide As slide
Dim shape As shape
Dim tr2 As TextRange2
If Not ActiveWindow.Selection.TextRange2 Is Nothing Then
Set tr2 = ActiveWindow.Selection.TextRange2
With tr2.ParagraphFormat
.LeftIndent = 3
.SpaceAfter = 3
.Alignment = ppAlignLeft
End With
Else
MsgBox "Veuillez sélectionner le texte auquel vous souhaitez ajouter une puce.", vbExclamation
End If
Set tr2 = Nothing
End Sub