ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink (https://www.excelbanter.com/excel-programming/419841-hyperlink.html)

Sri via OfficeKB.com

Hyperlink
 
Hello

I am writing a VB macro in Excel to populate some folder structures in few
cells. I would like to have these cells as hyperlinks so that one can click
on this cell to directly open that folder. Could anybody help me how to write
a hyperlink text in a cell through VB macro.

For example, my macro writes "C:\Documents and Settings\All Users" string
into cell A1. It should be written as a hyperlink so that user could go there
by simply clicking on the cell.

Please help.

Sri

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1


Mike H

Hyperlink
 
Try this

Hyperlinks.Add Anchor:=Range("A1"), Address:= _
"C:\Documents and Settings\All Users", TextToDisplay:= _
"""C:\Documents and Settings\All Users"""

Mike

"Sri via OfficeKB.com" wrote:

Hello

I am writing a VB macro in Excel to populate some folder structures in few
cells. I would like to have these cells as hyperlinks so that one can click
on this cell to directly open that folder. Could anybody help me how to write
a hyperlink text in a cell through VB macro.

For example, my macro writes "C:\Documents and Settings\All Users" string
into cell A1. It should be written as a hyperlink so that user could go there
by simply clicking on the cell.

Please help.

Sri

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1



Gary''s Student

Hyperlink
 

Say test is a folder in the C: drive

Sub HyperPlacer()
Dim s As String
s = "=HYPERLINK(""file:///C:\test"")"
Range("A1").Formula = s
End Sub

will place a hyperlink in A1. When clicked the folder will open.
--
Gary''s Student - gsnu200812


"Sri via OfficeKB.com" wrote:

Hello

I am writing a VB macro in Excel to populate some folder structures in few
cells. I would like to have these cells as hyperlinks so that one can click
on this cell to directly open that folder. Could anybody help me how to write
a hyperlink text in a cell through VB macro.

For example, my macro writes "C:\Documents and Settings\All Users" string
into cell A1. It should be written as a hyperlink so that user could go there
by simply clicking on the cell.

Please help.

Sri

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1



brzak

Hyperlink
 
On Nov 11, 2:02*pm, "Sri via OfficeKB.com" <u47062@uwe wrote:
Hello

I am writing a VB macro in Excel to populate some folder structures in few
cells. I would like to have these cells as hyperlinks so that one can click
on this cell to directly open that folder. Could anybody help me how to write
a hyperlink text in a cell through VB macro.

For example, my macro writes "C:\Documents and Settings\All Users" string
into cell A1. It should be written as a hyperlink so that user could go there
by simply clicking on the cell.

Please help.

Sri

--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200811/1



Sub HyperLinkToFolder()
Dim ShtName as String ' the name of the sheet containing the
hyperlink
ShtName = "Sheet1"

Sheets(ShtName).Hyperlinks.Add _
Anchor:=Sheets(ShtName).range("A1"), Address:= _
"C:\Documents and Settings\All Users", _
TextToDisplay:= "Hyper Link to a folder", _
ScreenTip:="Click Me"

End Sub

Enjoy

Brz

Sri via OfficeKB.com

Hyperlink
 
Thank you Mike. It works fine.

Sri

Mike H wrote:
Try this

Hyperlinks.Add Anchor:=Range("A1"), Address:= _
"C:\Documents and Settings\All Users", TextToDisplay:= _
"""C:\Documents and Settings\All Users"""

Mike

Hello

[quoted text clipped - 10 lines]

Sri


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1


Sri via OfficeKB.com

Hyperlink
 
Hello all

Thanks for your help.

Could you please help me in applying your method to my requirement.

I am printing my string with the following command.
"Worksheets("Design Steps").Cells(row_no, 7).Cells.Value = test_exec_dir"

How to integrate it with your below suggession (especially Range("A1") )???

Hyperlinks.Add Anchor:=Range("A1"), Address:= _
"C:\Documents and Settings\All Users", TextToDisplay:= _
"""C:\Documents and Settings\All Users"""

Thanks to all
Sri

brzak wrote:
Hello

[quoted text clipped - 13 lines]
--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200811/1


Sub HyperLinkToFolder()
Dim ShtName as String ' the name of the sheet containing the
hyperlink
ShtName = "Sheet1"

Sheets(ShtName).Hyperlinks.Add _
Anchor:=Sheets(ShtName).range("A1"), Address:= _
"C:\Documents and Settings\All Users", _
TextToDisplay:= "Hyper Link to a folder", _
ScreenTip:="Click Me"

End Sub

Enjoy

Brz


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200811/1



All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com