I use an application (HP Quality Center) that generates a Word .docx report with Attachments as Hyperlinks, where the hyperlinks point to the attachments on my PC's C:\ drive.
Clearly, I cannot send the report by email or move somewhere else, with the links.
I want to convert these hyperlinks to embedded objects.
I could use a Macro to iterate the hyperlinks, and add ole objects, but wondering whether ignoring the ClassType will be ok. The files could be .xls, pdf, doc, docx or others. Can I find the ClassType from looking at the filename?
Anyone done this before?
Thanks John
Update - what I have so far
Sub ConvertHyperLinks()
Dim num As Integer, i
Dim strFileName As String
Dim lngIndex As Long
Dim strPath() As String
num = ActiveDocument.Hyperlinks.Count
For i = 1 To num
hName = ActiveDocument.Hyperlinks(i).Name
strPath() = Split(hName, "\")
lngIndex = UBound(strPath)
strFileName = strPath(lngIndex)
Selection.InlineShapes.AddOLEObject _
FileName:=hName, _
LinkToFile:=False, DisplayAsIcon:=True, _
IconLabel:=strFileName
ActiveDocument.Hyperlinks(i).Delete
Next
End Sub
Seems I don't need ClassType because I want to use FileName.
Can anyone help with following (a) Position the cursor at the hyperlink, so I can enter a new line and the OLEObject at each place within the document. (b) Find the Icon to use from the .ext of the filename
Thanks