2016-11-20 72 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