VBA for shrinking the font in PowerPoint when text overflows

喜夏-厌秋 提交于 2019-12-08 03:01:57

问题


I'm trying to figure out a macros for PowerPoint files that I export after language conversion through a CAT tool. In some of the language pairs the translated content will not fit into the source file text boxes due to the differences in the language lengths.

Therefore, the translated and exported PowerPoint files contain multiple shapes/text boxes that have some content outside of the visible areas of such shapes. I was wondering what is way to get the newly exported textual content within all shapes/text boxes in the exported PPTs files shrunk globally throughout the file to fit the original sizes of those shapes - only for those shapes when a content overflow occurs.

All I really need is a macros with IF text height/length is more than shape height/length THEN lower font size by one until text dimensions = shape dimensions. I am working in MS Office 15.

Thank you for your input!


回答1:


Could you use the AutoSize property of the shape's TextRange and leave PowerPoint to automatically shrink the text based on the content because the fit will depend in the font face, size and style properties? You can do this with the following property:

oShp.TextFrame2.AutoSize = msoAutoSizeTextToFitShape


来源:https://stackoverflow.com/questions/35875719/vba-for-shrinking-the-font-in-powerpoint-when-text-overflows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!