ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   importing fixed machine data to excel (https://www.excelbanter.com/excel-worksheet-functions/64221-importing-fixed-machine-data-excel.html)

mike

importing fixed machine data to excel
 
i'm seeking for a possibility to import machine-data (such as "computer
name", cpu-id or any else string or row of digits that ar unique to a
pc, notebook, workstation etc.) to a excel.worksheet
since i'm not so experienced be patient with me... *g*
thanks in advance
mike


Gary L Brown

importing fixed machine data to excel
 
Here's some code you can copy to a module to see if any of it is what you are
looking for.
Run the 'ShowInfo' procedure...

'/==========================================/
Private Declare Function GetUserName Lib "ADVAPI32.DLL" _
Alias "GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long

'/==========================================/
Sub ShowInfo()
MsgBox GetNetworkUserName()
Call ListEnviron
End Sub
'/==========================================/
Private Function GetNetworkUserName() As String
Dim strUserName As String

On Error GoTo Err_GetNetworkUserName

strUserName = String(255, 0)
GetUserName strUserName, Len(strUserName)

GetNetworkUserName = Application.WorksheetFunction. _
Clean(strUserName)

Exit_GetNetworkUserName:
Exit Function

Err_GetNetworkUserName:
GetNetworkUserName = ""
Resume Exit_GetNetworkUserName

End Function
'/==========================================/
Sub ListEnviron()
'from Microsoft.Public.Excel.Programming
' by Normal Harker on 08/01/2001
'
Dim new_value As String
Dim txt As String
Dim i As Integer

On Error Resume Next

i = 1
Do
new_value = Environ$(i)
If Len(new_value) = 0 Then Exit Do
txt = txt & new_value & vbCrLf
i = i + 1
Loop
txt = txt & "Active Printer = " & _
Application.ActivePrinter & vbCrLf
txt = txt & "Default Path = " & _
Application.DefaultFilePath & vbCrLf
txt = txt & "Library Path = " & _
Application.LibraryPath & vbCrLf
txt = txt & "Operating System = " & _
Application.OperatingSystem & vbCrLf
txt = txt & "Organisation Name = " & _
Application.OrganizationName & vbCrLf
txt = txt & "Start Up Path = " & _
Application.StartupPath & vbCrLf
txt = txt & "Excel Version = " & _
Application.Version & vbCrLf
txt = txt & "Current Workbook Path = " & _
Application.ActiveWorkbook.Path & vbCrLf
txt = txt & "Active Woorkbook Name = " & _
Application.ActiveWorkbook.Name
MsgBox txt
End Sub
'/==========================================/


HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"mike" wrote:

i'm seeking for a possibility to import machine-data (such as "computer
name", cpu-id or any else string or row of digits that ar unique to a
pc, notebook, workstation etc.) to a excel.worksheet
since i'm not so experienced be patient with me... *g*
thanks in advance
mike




All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com