Mac的vba powerpoint创建不需要的空白行

问题描述

我正在尝试使用为Mac(Microsoft 365 for Mac)上的Windwos编写的PowerPoint宏。大部分工作都很好,但是有两个奇怪的事情。主要问题:Mac会创建多余的空白行。

TextFrame2.TextRange.Text = "Text 1" & vbCrLf & "Text 2" & vbCrLf & "Text 3"

&vbCrLf&仅在Windows PPT上产生一个中断,但在Mac上又产生一个空白行。有什么想法可以避免这种情况吗?

还有一个小问题: 我认为最好一直使用TextFrame2而不是TextFrame,但是在Mac上,当尝试在靠近代码结尾处使用标尺功能时,出现编译错误。如果有人对此有解决方案,我也将很高兴。

Private Sub ParameterColumnBodyStandard()

Dim shp As Shape
Dim i As Integer
    
Set shp = ActiveWindow.Selection.ShapeRange(1)

With shp
    .Fill.Visible = msoFalse
    .Line.Visible = msoFalse
With .TextFrame2
    .TextRange.Text = "Text 1" & vbCrLf & "Text 2" & vbCrLf & "Text 3"
    .VerticalAnchor = msoAnchorTop
    .MarginBottom = 5.6692878
    .MarginLeft = 5.6692878
    .MarginRight = 5.6692878
    .MarginTop = 5.6692878
    .WordWrap = msoTrue
With .TextRange
    .Font.Size = 16
    .Font.Name = "Arial"
    .Font.Fill.ForeColor.RGB = RGB(0,0)
    .Font.Bold = msoFalse
    .Font.Italic = msoFalse
    .Font.Underlinestyle = msoNoUnderline
    .ParagraphFormat.SpaceAfter = 6
    .ParagraphFormat.Alignment = ppAlignLeft
    .ParagraphFormat.Bullet.UseTextColor = msoFalse
    .ParagraphFormat.Bullet.UseTextFont = msoFalse
    .ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(0,0)
    .Characters(1,6).Font.Bold = msoFalse
                For i = 2 To 3
With .Paragraphs(i).ParagraphFormat.Bullet
    .Visible = msoTrue
End With
                Next
With .Paragraphs(2)
    .ParagraphFormat.IndentLevel = 2
    .ParagraphFormat.Bullet.Character = 8226
    .ParagraphFormat.Bullet.RelativeSize = 1
End With
With .Paragraphs(3)
    .ParagraphFormat.IndentLevel = 3
    .ParagraphFormat.Bullet.Character = 8226
    .ParagraphFormat.Bullet.RelativeSize = 1
End With
End With
End With
With .TextFrame
With .Ruler
     .Levels(2).FirstMargin = 14.173219
     .Levels(2).LeftMargin = 28.346439
     .Levels(3).FirstMargin = 28.346439
     .Levels(3).LeftMargin = 42.519658
End With
End With
End With

End Sub

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)