narlo
04-24-2013, 04:52 AM
I'm using the following code to replace the image in a folder of over 100 word documents. It works great, but ... when replacing the image I also want to set the Alternative (Alt) Text. I've scoured the net looking for an example and after two days, I've found nothing that directly addresses this and I'm wondering if you would help.
Sub ChangePic()
Dim oFile
oFile = Dir("O:\STUDIO\Brit\Forms-Unpacked\Forms-Unpacked\*.doc")
Do While oFile <> ""
Application.Documents.Open FileName:="O:\STUDIO\Brit\Forms-Unpacked\Forms-Unpacked\" & oFile
With Selection
.GoTo what:=wdGoToGraphic, Count:=1
.Delete
.InlineShapes.AddPicture FileName:="O:\STUDIO\Brit\Logo\dynamic.png"
End With
If ActiveDocument.Saved = False Then ActiveDocument.Save
ActiveDocument.Close
oFile = Dir
Sub ChangePic()
Dim oFile
oFile = Dir("O:\STUDIO\Brit\Forms-Unpacked\Forms-Unpacked\*.doc")
Do While oFile <> ""
Application.Documents.Open FileName:="O:\STUDIO\Brit\Forms-Unpacked\Forms-Unpacked\" & oFile
With Selection
.GoTo what:=wdGoToGraphic, Count:=1
.Delete
.InlineShapes.AddPicture FileName:="O:\STUDIO\Brit\Logo\dynamic.png"
End With
If ActiveDocument.Saved = False Then ActiveDocument.Save
ActiveDocument.Close
oFile = Dir