Thought I had solved the issue with https://access-programmers.co.uk/forums/showthread.php?t=294335, however,
Came across another word file that had a different font size. It was set to 18, so when my code ran it was changing 18 to 20 rather than keeping at 18. Tried to modify the code to evaluate the size but it returns 9999999 rather than the size of the font of the text in question. I put in a Debug.Print .Replacement.Font.Size as well as debug.Print .Font.Size and that is how I learned that it was not giving the size I was expecting. I did some web searching and so far haven't found an example that would apply to the situation. (at least based on my search terms).
Came across another word file that had a different font size. It was set to 18, so when my code ran it was changing 18 to 20 rather than keeping at 18. Tried to modify the code to evaluate the size but it returns 9999999 rather than the size of the font of the text in question. I put in a Debug.Print .Replacement.Font.Size as well as debug.Print .Font.Size and that is how I learned that it was not giving the size I was expecting. I did some web searching and so far haven't found an example that would apply to the situation. (at least based on my search terms).
Code:
For Each wdRng In wdDoc.StoryRanges
With wdRng.Find
.Text = FindText
.Replacement.Text = ReplaceText
[B]Debug.Print .Replacement.Font.Size[/B]
If Len(ReplaceText) > 50 AND .Font.Size > 20 Then
.Replacement.Font.Size = 20
End If
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Next wdRng
Last edited: