How can I create a hyperlink using VBA and Windows navigation?

I would like to create a hyperlink, say in cell A1, by running a macro that opens a Windows navigation panel.
In principle it would be exactly like right clicking a cell and clicking the hyperlink option.

I would like the macro to specify the cell that the hyperlink would be added to.
spar-kleOperations DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsDistinguished Expert - 2017Commented:
Hi,

Something like this:
Sub CreateHyperLink()
Dim Ws As Worksheet
Dim Rng As Range
Set Ws = Worksheets("Sheet1")
Set Rng = Ws.Range("A1")

Rng.Parent.Hyperlinks.Add Anchor:=Rng, Address:="", SubAddress:="Sheet1!A5", TextToDisplay:="Click Here to go to A5"

    With Rng.Font
        .ColorIndex = xlAutomatic
        .Underline = xlUnderlineStyleNone
    End With

    With Rng.Characters(Start:=21, Length:=2).Font
        .Underline = xlUnderlineStyleSingle
        .Color = -4165632
    End With

End Sub

Open in new window

It will create hyperlink in Cell A1 of Sheet1 to go to Cell A5
Create-Hyper-Link.xlsm
0
spar-kleOperations DirectorAuthor Commented:
Thanks Shuns.  I can see that will add a hyperlink according to the hard coding. However I want to click on a button ...open a navigation pane ...navigate to a file click on the file and create a link in a cell designated by the code.
0
spar-kleOperations DirectorAuthor Commented:
Sorry "Shums"
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ShumsDistinguished Expert - 2017Commented:
Hi,

Try below:
Option Explicit
Sub CreateHyperLink()
Dim Ws As Worksheet
Dim Rng As Range
Dim fName As String
Set Ws = Worksheets("Sheet1")
Set Rng = Ws.Range("A1")
fName = Application.GetOpenFilename
Rng.Value = fName
Rng.Hyperlinks.Add Anchor:=Rng, Address:=Rng.Value, TextToDisplay:="Open File"
End Sub

Open in new window

Create-Hyper-Link_v1.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
spar-kleOperations DirectorAuthor Commented:
That's excellent.
Thanks Shums
0
ShumsDistinguished Expert - 2017Commented:
You're Welcome! Please to help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.