2016-11-20 81 views
0

每當我跑在PowerPoint中的代碼,它從textranges,textframes刪除所有的子彈,但我希望將所有的子彈,因爲它是,如果有人知道請告知而不刪除子彈級別刪除雙空格

Sub removeSpaces() 
Dim shpText As String 

For Each sld In ActivePresentation.Slides 
    For Each shp In sld.Shapes 
     If shp.HasTextFrame Then 
      shpText = shp.TextFrame.TextRange.Text 'Get the shape's text 
      Do While InStr(shpText, " ") > 0 
       shpText = Trim(Replace(shpText, " ", " ")) 
      Loop 
     shp.TextFrame.TextRange.Text = shpText 'Put the new text in the shape 

     Else 
      shpText = vbNullString 
     End If 
    Next shp 
Next sld 
End Sub 
+0

不明確。請編輯問題並澄清:代碼應該做什麼,它做了什麼? – kebs

+0

無法重現該行爲:不會從mt測試幻燈片中刪除項目符號... –

回答

0

刪除修剪並嘗試。

Do While InStr(shpText, " ") > 0 
    shpText = Replace(shpText, " ", " ") 
Loop