Sunday, 4 March 2018

How to get computer name using VBA Excel MS Access/ VBA code to find the computer's name





Sometimes you might require to find user's computer name various scenarios like to track which computer has accessed the file or database, etc.

We can find the computer's name using below VBA code.

Function FindComputerName() as String
      FindComputerName = environ(6)
End Function


Note: Copy paste above function to your module, You can use it as an Excel function or call from a sub procedure.