Results 1 to 9 of 9
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    find/replace with carriage return (ppt xp)

    Is there a way to do a find/replace in ppt to find the lines that have <$> on them and delete the <$> plus the line feed or carriage return? The <$> will always appear on a line by itself. thanks

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: find/replace with carriage return (ppt xp)

    Without resorting to VBA, it appears there isn't a good way to do this and select the "paragraph" character as well. You can do the delete, but unless it's the last line of the text area, a blank line remains. Fortunately, the Find/Replace doesn't use wildcard characters, although the VBA version does.
    Wendell

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: find/replace with carriage return (ppt xp)

    how would i write a macro in vba to do it? thank you for the help.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: find/replace with carriage return (ppt xp)

    VBA could look like this:
    <pre>Sub testClearPara()
    ClearPara strTarget:="$"
    End Sub

    Sub ClearPara(strTarget As String)
    ' Replace matching paragraphs with nothing
    Dim sld As Slide, shp As Shape, intCount As Integer, para As TextRange
    For Each sld In ActivePresentation.Slides
    For Each shp In sld.Shapes
    If shp.HasTextFrame Then
    If shp.TextFrame.TextRange.Paragraphs.Count > 0 Then
    ' More than one paragraph; loop backwards
    For intCount = shp.TextFrame.TextRange.Paragraphs.Count _
    To 1 Step -1
    Set para = shp.TextFrame.TextRange.Paragraphs(intCount)
    If intCount = shp.TextFrame.TextRange.Paragraphs.Count Then
    ' No trailing CR+LF to match; leaves a blank bullet
    If para.Text = strTarget Then
    para.Delete
    End If
    Else
    If para.Text = strTarget & Chr(13) & Chr(10) Then
    para.Delete
    End If
    End If
    Next
    End If
    End If
    Next
    Next
    End Sub</pre>

    Or maybe there's a simpler way, but this seems to work okay for identical matches.

  5. #5
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: find/replace with carriage return (ppt xp)

    Thank you for this code. It is working fine. It just takes a while to go through the 80 slides. Is there a way i can limit it to just slides 35 to 46? Also, i tried recording a find/replace and no code was generated. I want to search for <curryr> in slides 1 to 80 and replace it with 2003. Thank you for the help.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: find/replace with carriage return (ppt xp)

    To limit the code to slides 35 to 46, replace

    For Each sld In ActivePresentation.Slides

    by

    Dim i As Integer
    For i = 35 To 46
    Set sld = ActivePresentation.Slides(i)

  7. #7
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: find/replace with carriage return (ppt xp)

    yes, that makes sense. thank you

    Do you know the code to search/replace from an excel macro to powerpoint? i tried recording a macro but no code came up in ppt. thanks

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: find/replace with carriage return (ppt xp)

    I know nothing about PowerPoint VBA., sorry.

  9. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: find/replace with carriage return (ppt xp)

    > Do you know the code to search/replace from an excel macro to powerpoint?

    You want to search inside a presentation file from inside Excel? Your best bet is to write and debug the code in a PPT first, and then figure out how to run it from Excel. What sometimes happens is that object names exist in both applications' object models and cause confusion, and those might need to be qualified with the application name. But first see if you can write the code in PPT.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •