Results 1 to 10 of 10

Thread: Use Regex in VBA to replace text between tags in PowerPoint (multiple occurences)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,096
    Location
    Nice Code. I was about to post this which does pretty much the same thing.

    Sub notRegX2()
    Dim oshp As Shape
    Dim osld As Slide
    Dim otxr2 As TextRange2
    Dim lngStart As Long
    Dim lngEnd As Long
    For Each osld In ActivePresentation.Slides
       For Each oshp In osld.NotesPage.Shapes
          If oshp.HasTextFrame Then
             If oshp.TextFrame2.HasText Then
                Set otxr2 = oshp.TextFrame2.TextRange
                While InStr(otxr2.Text, "<code1>") > 0
                   lngStart = InStr(otxr2.Text, "<code1>")
                   lngEnd = InStr(otxr2.Text, "</code1>") + Len("</code1>")
                   otxr2.Characters(lngStart, lngEnd - lngStart).Delete
               Wend
            End If
         End If
      Next oshp
    Next osld
    End Sub
    Last edited by Aussiebear; 04-09-2023 at 08:02 PM. Reason: Reduced the whitespace
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Tags for this Thread

Posting Permissions

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