Không biết có hàm nào trả về tên máy tính hay tên người dùng
Các anh chị cho hỏi, trong Excel có hàm nào trả về tên PC hay tên người dùng PC không nhỉ?
Nếu không có hàm build-in nào thì xin cho 1 cái code để dùng trong VBA
Cảm ơn các anh chị
cái màu đo đỏ kg có , có cái này kg biết fù hợp kg?
Function GetDriveSerialNumber(Optional ByVal DriveLetter As String) As Long Dim fso As Object, Drv As Object Set fso = CreateObject("Scripting.FileSystemObject") If DriveLetter <> "" Then Set Drv = fso.GetDrive(DriveLetter) Else Set Drv = fso.GetDrive(fso.GetDriveName(Application.Path)) End If With Drv If .IsReady Then DriveSerial = Abs(.SerialNumber) Else DriveSerial = -1 End If End With Set Drv = Nothing Set fso = Nothing GetDriveSerialNumber = DriveSerialEnd Function
Chắc bạn muốn cái này:
Function GetComputername()
Application.Volatile
GetComputername = Environ("COMPUTERNAME")
End Function
Function GetUserName()
Application.Volatile
GetUserName = Environ("USERNAME")
End Function
lấy được tên máy tính và user rồi sẽ hỏi lấy IP
vậy thêm luôn cho rồi anh tuấn nhỉSub getip() Set objWMIService = GetObject("winmgmts:\" & "." & "rootcimv2") Set IPConfigSet = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") For Each IPConfig In IPConfigSet If Not IsNull(IPConfig.IPAddress) Then Sheet1.Range("A1").Value = IPConfig.IPAddress(0) Next End Sub
www.giaiphapexcel.com/diendan/threads/kh%C3%B4ng-bi%E1%BA%BFt-c%C3%B3-h%C3%A0m-n%C3%A0o-tr%E1%BA%A3-v%E1%BB%81-t%C3%AAn-m%C3%A1y-t%C3%ADnh-hay-t%C3%AAn-ng%C6%B0%E1%BB%9Di-d%C3%B9ng.99550/
Khóa học Power PI – Ứng dung trong Nhân sự
TỔNG QUAN KHÓA HỌC: POWER BI CHO NGÀNH NHÂN SỰ Khóa học Power BI cho Nhân sự được thiết kế dành riêng cho các...
Xem khóa học