REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

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.

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 open file

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:temptest.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:temptest.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:temptest.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

Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: VBATags: Last Updated: June 17, 2022

Leave A Comment