Microsoft Office Forums Computer Name

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2019, 08:15 AM
hickeyt hickeyt is offline Computer Name Windows 10 Computer Name Office 2007
Novice
Computer Name
 
Join Date: Apr 2019
Posts: 5
hickeyt is on a distinguished road
Default Computer Name

Is there a VBA function to return the computer name?
Reply With Quote
  #2  
Old 04-26-2019, 10:19 AM
hickeyt hickeyt is offline Computer Name Windows 10 Computer Name Office 2007
Novice
Computer Name
 
Join Date: Apr 2019
Posts: 5
hickeyt is on a distinguished road
Default Answer

Application.Username will return the name of the PC
Reply With Quote
  #3  
Old 04-26-2019, 01:22 PM
NoSparks NoSparks is offline Computer Name Windows 7 64bit Computer Name Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 722
NoSparks will become famous soon enoughNoSparks will become famous soon enough
Default

Are you sure about that?
Or is it not the computer name that you really want?

On my computer, In the vba Immediate window, these lines give three different results.
Only one is the actual computer name.
Code:
? Application.Username

? Environ$("username")

? Environ$("computername")
Reply With Quote
  #4  
Old 04-26-2019, 01:37 PM
Alansidman's Avatar
Alansidman Alansidman is offline Computer Name Windows 10 Computer Name Office 2019
Advanced Beginner
 
Join Date: Apr 2019
Location: Steamboat Springs
Posts: 30
Alansidman is on a distinguished road
Default

An alternative means to get the same results

Code:
Option Explicit

Sub CompName()
    MsgBox (Application.UserName)
    MsgBox (Environ("username"))
    MsgBox (Environ("computername"))
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Font and Format changes from computer to computer / device FHANNAN87 Outlook 1 04-19-2017 03:28 PM
Computer Name New computer RetamaRobert Office 3 03-25-2011 02:14 PM
Computer Name New Computer Rayddd Outlook 1 01-13-2011 07:32 AM
Computer Name Should I buy new software for a new computer? Balliol Office 1 12-27-2010 03:09 PM
Computer Stolen-Install Office 2007 On New Computer corndale Office 0 08-23-2010 09:52 AM


All times are GMT -7. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft