VBA – Excel custom functions – Document Properties

If you program with Excel and VBA, probably you have plenty of various functions, showing you how to access some of the file properties. Mainly file path and file name. With the current VBA module, you may see how to access 9 different properties through a custom Excel formula.

MS_Excel

The properties are the following:

  1. Path with the file name
  2. Path without the file name
  3. Name
  4. Type
  5. Size of the file
  6. Date created
  7. Date last modified
  8. Date last accessed
  9. The name of the user, as registered in  the MS Office

In order to obtain any of these, you should simply write in any Excel cell “=DocumentProperty(n)”. In the place of “n” you should put one of the numbers, from 1 to 9.

Here comes the code! 🙂

😛

About

VBA Developer

Tagged with: , ,