LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary L Brown
 
Posts: n/a
Default 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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing Microsoft query data into excel changes linked rows Wazzy_bear Links and Linking in Excel 1 December 19th 05 09:09 AM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
Excel 2003, Convert EXISTING Worksheet Data to XML? [email protected] Excel Discussion (Misc queries) 4 November 16th 05 04:45 AM
Importing data from palm excel to desktop workbook jchandler50 Excel Discussion (Misc queries) 0 August 7th 05 04:57 AM
Importing data from Excel to Outlook JTRNPTNY Excel Discussion (Misc queries) 1 August 5th 05 03:35 PM


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"