View Single Post
 
Old 12-09-2023, 01:30 PM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

As a simple variant:
Code:
Sub Test()

Dim oRng As range
Dim vWd As Variant
 Dim vHi As Variant

    Set oRng = ActiveDocument.range
    With oRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = "width=^#^#^#"
        .Replacement.text = ""
        .MatchWildcards = False
        .Forward = True
        .Wrap = wdFindStop
        If .Execute Then vWd = oRng
    End With

    Set oRng = ActiveDocument.range
    With oRng.Find
        .text = "height=^#^#^#"
        If .Execute Then vHi = oRng
    End With

    With ActiveDocument.range.Find
        .text = "\<" & "img width" & "*" & "\>\<"
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
MsgBox vWd & vbCr & vHi
lbl_Exit:
Set oRng = Nothing
End Sub
Reply With Quote