Open a File using FollowHyperlink Method

Home/VBA/Open a File using FollowHyperlink Method

VBA code to open a file using Followhyperlink method will help you opening a workbook or anything using Excel VBA. VBA open file example we will see how to open a excel workbook using VBA.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


VBA Code to Open a File using FollowHyperlink Method

Followhyperlink method is very interesting technique available in Excel VBA. This will help us to open anything or any application in default application. Following are the example VBA syntax and VBA code to open a file using Followhyperlink method in Excel VBA.

VBA Code to Open a File using FollowHyperlink Method : Syntax

Followhyperlink method of Excel Workbook to open any file, website, or folder. Here is the syntax, we need to specify the file path to open.


ThisWorkbook.FollowHyperlink ("C:\temp\test.xlsx")

Examples of VBA Code to Open a File using FollowHyperlink Method

The following examples will show you how to use FollowHyperlink method of Excel workbook to open different applications.

VBA Code to Open a Excel File using FollowHyperlink Method:
The following Excel VBA code example is to opening a excel file using VBA Followhyperlink method.

Sub sbVBA_To_Open_Excel_File_FollowHypderlink()
Dim strFilePath As String
strFilePath = "C:\temp\test.xls"
ThisWorkbook.FollowHyperlink (strFilePath)
End Sub

Explained VBA Code to Open a Excel File using FollowHyperlink Method:

‘Excel VBA code/procedure to Open a File using FollowHypderlink method
Sub sbVBA_To_Open_Excel_File_FollowHypderlink_C()
‘Declaring a variable strFilePath as string to cappture the file path
Dim strFilePath As String

‘Asigning the File Path to the Variable created above
strFilePath = “C:\temp\test.xls”

‘Opening the file using FollowHyperlink method of Workbook
ThisWorkbook.FollowHyperlink (strFilePath)

‘Ending the sub procedure
End Sub

VBA open file related Examples:

VBA Code to Open a website URL using FollowHyperlink Method:

Sub sbVBA_To_Open_Website_URL_FollowHypderlink()
Dim strURL As String
strURL = "analysistabs.com"
ThisWorkbook.FollowHyperlink (strURL)
End Sub

Explained VBA Code to Open a website URL using FollowHyperlink Method:

‘Excel VBA code/procdure to Open an URL using FollowHypderlink method
Sub sbVBA_To_Open_Website_URL_FollowHypderlink_C()
‘Declaring a variable strURL as string to capture the URL
Dim strURL As String

‘Asigning the URL to the Variable created above
strURL = “analysistabs.com”

‘Opening the URL using FollowHyperlink method of Workbook
ThisWorkbook.FollowHyperlink (strURL)

‘Ending the sub procedure
End Sub

VBA Code to Open a Folder using FollowHyperlink Method:

Sub sbVBA_To_Open_Folder_FollowHypderlink()
Dim strFolderPath As String
strFolderPath = "C:\temp\"
ThisWorkbook.FollowHyperlink (strFolderPath)
End Sub

Explained VBA Code to Open a Folder using FollowHyperlink Method:

‘Excel VBA code/procdure to Open a Folder using FollowHypderlink method
Sub sbVBA_To_Open_Folder_FollowHypderlink()

‘Declaring a variable strFolderPath as string to capture the Folder path
Dim strFolderPath As String

‘Asigning the Folder path to the Variable created above
strFolderPath = “C:\temp\”

‘Opening the Folder path using FollowHyperlink method of Workbook
ThisWorkbook.FollowHyperlink (strFolderPath)

‘Ending the sub procedure
End Sub

LIMITED TIME OFFER
By |April 22nd, 2014|VBA|0 Comments

About the Author:

PNRao is a passionate business analyst and having close to 10 years of experience in Data Mining, Data Analysis and Application Development. This blog is his passion to learn new skills and share his knowledge to make you expertise in Data Analysis (Excel, VBA, SQL, SAS, Statistical Methods, Market Research Methodologies and Data Analysis Techniques).

Leave A Comment


Related pages


team capacity planning xlsexcel unhide all tabsvba left stringproject management dashboard excel template free downloadvlookup excel 2010 exampleexcel team schedule templateadvanced vba excel examplesunhide columns in excel 2010how do i find duplicates in excelhow to check duplicates in excel 2007remove hyperlinks excelvba create graphvba sheets selectddl and dml commandsexcel how to use sumifexcel clear blank cellsexample of excel formulashow to unhide columns on excelspotfire dashboard examplesmacro excel open filexml converter to excelhow to alphabetize in excel 2013excel vba sample projectsexcel isrefhow to delete blank rows in excel 2010database macrosunprotect an excel filehow to create hyperlink in excelinterview questions and answers for mis executivecells vbaduplicate rows exceladvanced filter vbadownloadable gantt chartdashboards in excelwhat is countif function in excelwindows excel shortcut keysexcel macro lookuphow to learn pivot table in excel 2007how to duplicate a row in excel3d surface plot excelhow to use the vlookup functionsample vba projectshow can i find duplicates in exceldeveloper toolbar excelhow do i make a pivot table in excel 2010concatenate formula excelcheckbox syntaxvba excel macroexcel column width cmms excel formulas vlookupcost estimating spreadsheetexcel 2003 to 2013 converterfrequently asked interview questions in sqlbasic interview questions for freshersvba cell selectionformula of vlookup in excel with exampleworksheet.protectunhide excel 2010word vba formhow to extract duplicates in excelactivesheet.listobjectsexcel vba made easyhow do you sort columns in excelmacro for merging excel filesvba offset rowactiveworkbook vbavlookup in excel exampletechnical questions for freshers interviewnested iif statements in accessexcel macros password removersas tutorial pdf beginnersnumber of rows in excel 2003ms excel chart typesadd developer tab to the ribbonformula of vlookup in excel with examplevba function exampleuse of pivot table in excel 2010excel macro visual basictcl in sql serverexcel vba clearcontentsexcel vba macros