PDA

View Full Version : Powerpoint - find and replace tabs in a string



ilKavall
02-25-2013, 03:06 AM
Hi,

I don't usually use PowerPoint so am used to Word's record macro function, could really use some help! Someone has given me over 500 slides where all the bullet points which go onto two lines have been made by hitting enter rather than just typing onto the next line... no idea why. The author then aligned the left edge of the text by hitting tab on the second/third lines of the bullets.

I figured the easiest way to fix this would be a search and replace of "(text)paragraph mark,tab character(text)" but haven't really got a clue how to go about doing this in VBA. I've tried looking around on google for some answers but didn't really get anywhere.

Can anyone help?

Thanks!

Bill

John Wilson
02-26-2013, 04:41 AM
Whether you can do this will depend on EXACTLY what they did!

(Foolproof?? Never underestimate the ingenuity of fools)

This might work but test on a copy!

Sub replaceMe()
Dim osld As Slide
Dim oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.HasTextFrame Then
'look for newline followed by Tab and switch to SPACE
With oshp.TextFrame.TextRange
.Text = Replace(.Text, vbCr & vbTab, " ")
End With
End If
Next oshp
Next osld
End Sub