locked
Finding Computer name from VBA RRS feed

  • Question

  • Hi, all. The title says it all. Can anyone suggest how I can obtain the computer name from within some VBA code, please? I am running the same Excel file, with extensive macros, on two different PCs. But I need to save the file(s) in different locations, depending on which PC is being used.

    Thanks in advance

    Peter

    Wednesday, May 10, 2017 7:35 PM

Answers

  • Sub test()
    Dim cn As String
    
    cn = Environ("computername")
    End Sub


    • Marked as answer by XL Training Saturday, January 25, 2020 11:56 AM
    Wednesday, May 10, 2017 8:54 PM

All replies