Problems generating an html link based on worksheet values

  • Thread starter Frederik Romanov
  • Start date
F

Frederik Romanov

I want to generate a hyper link based on text in a cell, for example
the cells D16 and D17 generate the text strings in F16 and F17, which
are valid filenames. I have two macros
MakeLink_file
MakeLink_datNum
that should both generate hyperlinks for me (source for these below),
however MakeLink_file does not work, whereas MakeLink_datNum does (I
want to use the more generic MakeLink_file version). Any ideas why
the simpler macro does not work?

Fred


D16 = 4383
D17 = 1267

F16 = \\FDR-server\General Pool\Beatrix\DATA SHEETS\FDR_PDF\4383 DAT
01.pdf
F17 = \\FDR-server\General Pool\Beatrix\DATA SHEETS\FDR_PDF\1267 DAT
01.pdf

This hyperlink does not work
E16 = MakeLink_file(F16)
= \\FDR-server\General Pool\Beatrix\DATA SHEETS\FDR_PDF\4383 DAT
01.pdf

This hyperlink does work
E17 =MakeLink_datNum(D17)
= \\FDR-server\General Pool\Beatrix\DATA SHEETS\FDR_PDF\1267 DAT
01.pdf

Public Function MakeLink_datNum( datNum)
'
' Macro recorded 2003-07-01 by Fred

MakeLink_datNum = "\\FDR-server\General Pool\Beatrix\DATA
SHEETS\FDR_PDF\" _
& datNum _
& " DAT 01.pdf"

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=
MakeLink_datNum

Selection.Font.ColorIndex = 0

End Function

Public Function MakeLink_file( file)
'
' Macro recorded 2003-07-01 by Fred

MakeLink_file = file
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= file
Selection.Font.ColorIndex = 0

End Function
 

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