+ Reply to Thread
Results 1 to 2 of 2

importing fixed machine data to excel

  1. #1
    mike
    Guest

    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


  2. #2
    Gary L Brown
    Guest

    RE: 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
    gary_brown@ge_NOSPAM.com
    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
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1