VBA命令在TextFrame2中自动调整文本大小

时间:2022-07-09 13:05:30

I have the following code snippet to add a slide to the end of a Microsoft PowerPoint presentation and designate a title / subtitle:

我有以下代码片段将幻灯片添加到Microsoft PowerPoint演示文稿的末尾并指定标题/副标题:

longSlideCount = ActivePresentation.Slides.Count

With ActivePresentation.Slides
    Set slideObject = .Add(longSlideCount + 1, ppLayoutTitle)
End With

' ------------------------------ make the main title ------------------------------------- '

slideObject.Shapes(1).TextFrame.TextRange.Text = "This is the Main Title Text"
slideObject.Shapes(2).TextFrame.TextRange.Text = "This is the SubTitle Text"

Is it possible to shrink / grow the text in the title string to fit on one line in the text frame?

是否可以缩小/增长标题字符串中的文本以适合文本框架中的一行?

1 个解决方案

#1


0  

Use .Textframe2.Autosize = msoAutoSizeTextToFitShape

使用.Textframe2.Autosize = msoAutoSizeTextToFitShape

#1


0  

Use .Textframe2.Autosize = msoAutoSizeTextToFitShape

使用.Textframe2.Autosize = msoAutoSizeTextToFitShape