Discussion:
|
Knowing the current local directory can be quite valuable. For a given application, e.g., Excel, one can use ActiveWorkbook.Path. Or if the application is Word, you can use ActiveDocument.Path. These approaches are fine if the target code is specific to an application. But when the code is more general and could be used in multiple applications, then the task of determining the local directory is a bit more involved. LocalPath solves this problem using a brute force approach. It tests for the application name and then uses the relevant .Path property. For example, if LocalPath determines that the application is Excel, it uses ActiveWorkbook.Path. If LocalPath determines that the application is MSProject, it uses ActiveProject.Path. LocalPath is limited to MS applications. The demonstration consists of individual Excel, PowerPoint and Word files.
|