Category Archives: Files and Folders

Excel VBA: Display File Name as Hyperlink

In this article we will show you how to display file name as a hyperlink to a file in Excel. We first introduced this concept in this article but will expand upon it here. For this we will use the Hyperlinks.Add Method. Let’s have a

The GetOpenFilename Command in VBA

How often in your VBA code do you have ask for a file name along with its complete path as an input from the user? Most programmers end up using an input box in this situation. However, this is not very convenient for the user. Furthermore, there are

Using Application.Filedialog in Microsoft Excel VBA

What is the Application.FileDialog VBA function and how do you use it? Basically, it returns a FileDialog object instance of the dialog. This is similar to the functionality of the standard Open and Save dialog boxes found in Microsoft Office applications. Using these dialog boxes, users

The Excel VBA Application.FileDialog Object

Have you ever wished you could develop a simple way for users to select files to open from within Excel? Perhaps you want to impose a level of control over which file path users select the file(s) from. This can be done by using the

No Thumbnail

Word VBA, Get Current File Path and Name

In this article I will explain how you can get the current path and name of the word document you are working with. – File Path: The file path can be obtained using the code below: Dim strPath As String strPath = ThisDocument.FullName MsgBox (strPath) Result: Note:

No Thumbnail

Excel VBA, Get Current File Path and Name

In this article I will explain how you can get the current path and name of the file you are working with. – File Path: The file path can be obtained using the code below: Dim strPath As String strPath = ThisWorkbook.FullName MsgBox (strPath) Result: Note:

No Thumbnail

VBA Check File Exists

In this article I will explain how you can check if a file exists using VBA. Lets say we have the file “TempFile.xlsx” in the path “D:StuffBusinessTemp”: The code below will check if the file with the full path “D:StuffBusinessTempTempfile.xlsx” exists or not. An appropriate message

No Thumbnail

VBA Copy File

In this article I will explain how you can use VBA to copy a file. – Basics: The function below receives as input 2 file paths. The first parameter determines the location of the file to copy. The second  determines the location to copy the file to: