Hi, RobiNew! Try this (perhaps, not the best method, but it works):
Code:
Sub Test()
Dim oRng As range
Dim oRngD As range
Dim oRngDD As range
Dim vWd As Variant
Dim vHi As Variant
Set oRng = ActiveDocument.range
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "\<img width*\>"
.Replacement.text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
If .Execute Then
Set oRngD = oRng.Duplicate
Set oRngDD = oRng.Duplicate
.text = "width=" & "[0-9]@ "
.MatchWildcards = True
If .Execute Then vWd = oRng
With oRngD.Find
.text = "height=" & "[0-9]@ "
.MatchWildcards = True
If .Execute Then vHi = oRngD
End With
End If
End With
oRngDD = "<img " & vWd & vHi & "img src=" & Chr(34) & "data:image/jpg;base64,"
oRngDD.Collapse wdCollapseEnd
oRngDD.InsertAfter Chr(34) & ">"
oRngDD.Collapse
oRngDD.InsertFile filename:="C:\E_DIME.txt", range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
lbl_Exit:
Set oRng = Nothing
Set oRngD = Nothing
Set oRngDD = Nothing
End Sub