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


excel graphs examplesarray vba excelvba hyperlinkweekly task planner templatehow do i remove blank rows in excelexcel add row shortcutremoving duplicates in excel 2010selection.pastespecialaccess 2010 msgboxformula for adding columns in excelcut and paste worksheethow to hide unhide rows in excelexcel counting duplicatesexcel functions vlookupexcel macros vbaconsolidate excel spreadsheets into onehow to delete numbers in excelxlworkbook.saveasestimating templatesexcel activeworkbook saveasexcel macro remove blank rowsexcel chrrecordset excel vbasheets excel vbaexcel vba chartshow do you delete a sheet in excelremove all hyperlinks excel 2007how to highlight duplicate rows in excelaccess vba insert recordformulas in vbaconcatenate excel sheetshow to remove duplicate data in excel 2010excel consolidate rowsdim fso as filesystemobjectexcel rngno of rows and columns in excel 2007access vba listboxunprotect excel sheet without password 2007if formula in excel 2007 with examplevlookup tutorial 2010excel formula isna vlookupvba instr syntaxxls macro tutorialunhide columns in excel 2013data analyst interview questions and answers for freshersmicrosoft excel how to merge cellsexcel macro sampleschart wizard on excelautosave excel 2003how to insert comment in excelmsdasql downloadactivate a workbookexcel simple gantt chart templatehow to use the vlookup functionsumifs excel examplemacros for excel 2007excel formula to calculate difference between two datesvba import excel to accessworkbook objectcreate stacked bar chart excel 2010vba checkboxmacros excel 2007meaning of excel in hindidelete activexif iserror vlookup excel 2010excel vba rows selectinteractive calendar excelexcel tracker templateshow to use the sumif function in microsoft excel 2010vba booleanexcel vba macros tutorialvba excel forms for data entrydashboard in excel tutorialsql and sas trainingactivecell selecta tick in excel