
Use a user-defined function to get the path of
a workbook
Continue with the same worksheet for this task. Here, we want to
determine the path of the active workbook.
4
To find the path of a workbook:
1. Press <Alt+F11> to open the Visual Basic Editor.
2. From the Insert menu, click Module.
3. Type the following function:
Function WkbPath()
WkbPath = ActiveWorkbook.Path
End Function
4. Close the VBA Editor by pressing <Alt+Q> and in cell A4
type the following function: =WkbPath().
5. Press <Enter>.
324
Chapter 13