VBA程序 在PPT中使用宏命令删除空白的文本框
生活随笔
收集整理的這篇文章主要介紹了
VBA程序 在PPT中使用宏命令删除空白的文本框
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
打開(kāi)PPT,切換到視圖菜單下,點(diǎn)擊宏,輸入宏的名稱(如clear),點(diǎn)擊創(chuàng)建。進(jìn)入命令窗口,復(fù)制以下命令編譯執(zhí)行即可。
Sub clear() Dim found As Boolean Dim textflag As Boolean Dim trng As TextRange Do found = False For Each Sld In ActivePresentation.SlidesFor Each shp In Sld.ShapesIf shp.HasTextFrame Thentextflag = FalseIf shp.TextFrame.HasText ThenSet trng = shp.TextFrame.TextRangeFor i = trng.Characters.Count To 1 Step -1If trng.Characters(i) <> " " Thentextflag = TrueExit ForEnd IfNextEnd IfIf shp.Type <> 1 ThenIf Not shp.TextFrame.HasText Or textflag = False ThenActiveWindow.View.GotoSlide Index:=shp.Parent.SlideIndexshp.Selectshp.Deletefound = TrueEnd IfEnd IfEnd IfNext shp Next Sld Loop While found = True End Sub注意:上面的宏名稱是clear,可以改成自己喜歡的名字。
總結(jié)
以上是生活随笔為你收集整理的VBA程序 在PPT中使用宏命令删除空白的文本框的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: WooCommerce入门指南:添加新订
- 下一篇: dav视频播放器