View Single Post
 
Old 07-15-2019, 06:51 AM
KarenK13 KarenK13 is offline Windows 10 Office 2013
Novice
 
Join Date: Jul 2019
Posts: 6
KarenK13 is on a distinguished road
Default

Quote:
Originally Posted by JohnWilson View Post
Not easy!

Here's a possible start for you to work on

Code:
Sub regxz()

Dim oMatches As Object
Dim i As Long
Dim otr As TextRange2
Dim osld As Slide
Dim oshp As Shape
Dim regX As Object
Dim strmatch As String
Set regX = CreateObject("VBScript.RegExp")

' this allows for smart curly quotes
strmatch = "[" & Chr(147) & "," & Chr(34) & "]" & ".*" & "[" & Chr(148) & "," & Chr(34) & "]"
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.HasTextFrame Then
If oshp.TextFrame2.HasText Then Set otr = oshp.TextFrame2.TextRange
On Error Resume Next
With regX
    .Global = True
    .IgnoreCase = True
    .Pattern = strmatch
    Set oMatches = .Execute(otr)
    For i = 0 To oMatches.Count - 1
       otr.Characters(oMatches(i).FirstIndex + 1, Len(oMatches(i).Value)).Font.Italic = True
    Next i
End With
End If
Next oshp
Next osld
End Sub
Hi John,

You are absolutely amazing!!! I spent hours searching the internet and trying macros but I didn't know how to manipulate the code for italic.

This worked perfectly!!! Thanks so much!!!

Karen
Reply With Quote