View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cesar Zapata[_2_] Cesar Zapata[_2_] is offline
external usenet poster
 
Posts: 66
Default hyperlink file via macro?

Try this. change to suit your needs.

Dim cell As Range

For Each cell In Selection

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="C:\testt\" &
cell.Value _
, TextToDisplay:=cell.Value
Next cell

End Sub



Chao

Cesar



"Lobo" wrote in message
...
Hi all,

I have a spreadsheet with a column of files

example:
Column A
Row 1 asdf.doc
Row 2 zxcv.xls
Row 3 qwer.doc

is there a way to make it so that If i click on a cell, that it will

automatically go to that file on the system?

I have 3 directories that the files can be possibly stored on based on

their type.
Lets say that my workbook is test.xls and it is located in C:\test.xls.
I have three files located in three directories
C:/directory1/asdf.doc
C:/directory2/zxcv.xls
C:/directory3/qwer.doc

I need to beable to click on a cell
for instance clicking on A1 which contains the text "asdf.doc"
and the macro will automatically search the 3 directories for asdf.doc and

then open the file.

Is this possible? Any help would be grand.

-Lobo