View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default Paste a hyperlink

quartz

Try this


Sub test()

Dim sVar As String

sVar = "c:\book1.xls"

With Sheet1.Range("A1")
.Hyperlinks.Add .Cells(1, 1), sVar
End With

End Sub


--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

quartz wrote:
I have a the full name of a file in a string variable. I need example
code on how to paste it into a cell as a hyperlink, so that if it is
clicked the file will open in its native format (i.e. Excel in Excel,
Word in Word, etc.).

I tried to record it, but that doesn't work. Can somone please help
me out?

Thanks much in advance.