View Single Post
 
Old 01-02-2020, 08:47 AM
noslenwerd noslenwerd is offline Windows 10 Office 2016 for Mac
Novice
 
Join Date: Dec 2019
Posts: 15
noslenwerd is on a distinguished road
Default

Works perfectly!

Is there anyway to parlay alignment and text wrap into this? I tried the code below, but the bolded code does not work.

Code:
Sub DSSImages()
Dim StrImg As String
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .Text = "\<img src=[!\>]@\>"
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Text = ""
    .Forward = True
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Execute
  End With
  Do While .Find.Found = True
    StrImg = Replace(Replace(Replace(Split(Split(.Text, ">")(0), "=")(1), Chr(34), ""), Chr(147), ""), Chr(148), "")
    .Text = vbNullString
    .InlineShapes.AddPicture StrImg, False, True, .Duplicate
    .WrapFormat.Type = wdWrapSquare
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
Lastly... (I am not asking you to write this code, I am curious if anything exits):

We need to source all of our images. So I would love to find a way to have the html below, pull in the image, and have a source link below it (where we found the image in the first place).

<img src="C:\test\logo.jpg" cap="http://linktothesource.com">
Reply With Quote