What is the syntax to open a folder through a hyperlink?

Dim sXLFile As String
sFolder = “<folder’s filepath>
ActiveWorkbook.FollowHyperlink Address :=sFolder, NewWindow:=true

To learn how to find a folder’s filepath, click here.

‘example that opens the Downloads window upon clicking link
Dim sXLFile As String
sFolder = “C:\Users\jwatson\Downloads”
ActiveWorkbook.FollowHyperlink Address :=sFolder, NewWindow:=true
Advertisements

What is the syntax to add a hyperlink to cell?

Sheets(“<sheet name>”).Hyperlinks.Add Range(“<cell reference>”), “<http://www.yourwebsite.com>
'examples
Sheets(“resourceSheet”).Hyperlinks.Add Range(“B2”), “http://www.mysyntaxvba.wordpress.com”
ActiveSheet.Hyperlinks.Add Range(“B2”), “http://www.mysyntaxvba.wordpress.com”

Default formatting for hyperlinks on Excel is a blue text with a blue underline.