如何解决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 举报,一经查实,本站将立刻删除。