0

我正在尝试在 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, 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, 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
4

0 回答 0