Convert HYPERLINK to into INCLUDEPICTURE

K

kadnet

Hi all,

Using VB, I'm trying to find a way to scan through a word document
which has many hyperlinks to gif files and for each, replace the
HYPERLINK to gif with an INCLUDEPICTURE of gif.
I know how to loop hyperlinks collection, but am getting stuck how to
replace the document hyperlink with the picture from the web page.

Any ideas?

Regards,

Mick
 
J

Jezebel

You can do it with code along these lines:

Dim pRange as Word.Range
Dim pHyperlink as Word.Hyperlink
Dim pFile as string

For each pHyperlink in ActiveDocument.Hyperlinks
set pRange = pHyperlink.Range
pFile = pHyperlink.Address
pRange.Fields(1).Delete
pRange.Fields.Add Range:=pRange, Type:=wdFieldIncludePicture,
Text:=pFile
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top