Hyperlink points correctly, doesn't display right

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

I have a search routine in my workbook that finds the name of a document
from an active cell on another worksheet, then inserts a hyperlink to that
document. The hyperlink often does not change to reflect a new document -
yet, when moused over or clicked, it's pointing to the correct document.
I've tried F9 on the hyperlink cell, but it still doesn't change. Any
suggestions?

Ed
 
Sorry - forgot my code. The data, including the doc name, is on Sheet1.
The searc function is activated by a button on sheet "Get Doc".

Sub FindTIR()

Dim strLocation As String
Dim strName As String

' Find search path
strLocation = ThisWorkbook.Path

Application.ScreenUpdating = False

' Get doc name from list page
Sheets("Sheet1").Activate
strName = ActiveCell.Text

Sheets("Get Doc").Activate

Application.ScreenUpdating = True

With Application.FileSearch
.NewSearch
.LookIn = strLocation
.SearchSubFolders = False
.Filename = strName & ".doc"
.Execute

Set rngFiles = Range("B10")
rngFiles.Offset(0, 0) = "Found " & .FoundFiles.Count & " TIR " &
..TextOrProperty
For lngIndex = 1 To .FoundFiles.Count
ActiveSheet.Hyperlinks.Add Anchor:=rngFiles.Offset(lngIndex, 0),
Address:=.FoundFiles.Item(lngIndex)
Next
End With
 
Back
Top