VBA: delete extra line at end of para

E

EAJSewell

I have a macro that breaks up paragraphs in powerpoint. Within I have
code to delete the carriage return from the end of the newly created
smaller paragraphs. In PPT2003 this works... (OK it is clunky)
Do
Paraend = Right(NewPara.text, 1)
ParaendAsc = Asc(Paraend)

If ParaendAsc = 10 Then
LastChar = Left(Right(NewPara.text, 7), 5)
NewPara.Replace LastChar & vbCrLf, LastChar
End If
Loop Until ParaendAsc <> 10

This does not work in PPT2007, I know the end of para in 2007/later is
now vbCr (Char(13)) but just replacing the code with...
Do
Paraend = Right(NewPara.text, 1)
ParaendAsc = Asc(Paraend)

If ParaendAsc = 13 Then
LastChar = Left(Right(NewPara.text, 7), 6)
NewPara.Replace LastChar & vbCr, LastChar

End If
Loop Until ParaendAsc <> vbCr

does not work (in fact it is continuous loop) because I cannot get rid
of the Carriage return. I have tried lots of methods like
Set NewPara = NewPara.Characters(, Len(NewPara.text) - 1)

and looked (I think) everywhere. The finished paragraph always ends
up with a blank line Any ideas much appreciated.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top