using loop to write directory contents as hyperlinks

G

gls2815

Hi,

I have a looping sub statement that JE wrote that writes the filenames
of all the excel files contained in a directory into the active
workbook. Here it is:
========================
Sub LoopThroughXLS()

Const nMACPATH As String = _
"users:gerard:Desktop:Bids-Accepted:"
Dim nCount As Long
Dim sFName As String
#If Mac Then
sFName = Dir(nMACPATH, MacID("XLS8"))
#Else
sFName = Dir("*.xls")
#End If
Do While Len(sFName) > 0
Cells(4 + nCount, 2).Value = sFName
nCount = nCount + 4
sFName = Dir
Loop
End Sub
========================
My question is can the resulting filename be turned into a hyperlink
that in turn opens the file in Excel when clicked?

Thanks,

G
 

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