Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to capture information into an Excel Spreadsheet specifically a
couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
msgbox Environ("UserName") & vbcrlf & Environ("ComputerName")
-- HTH... Jim Thomlinson "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
you can get the username using VBA with the following command
application.UserName To the best of my knowledge, for other system variables you'll have to do a Windows API call -- Kevin Backmann "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
BD
Try this little "pulled off the groups" goodie to get a whack of stuff in a message box. Sub LISTENVIRON() Dim new_value As String Dim Txt As String Dim i As Integer 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 & "UserName = " & Application.UserName & vbCrLf 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 Workbook Name = " & Application.ActiveWorkbook.Name MsgBox Txt End Sub Gord Dibben MS Excel MVP Gord Dibben MS Excel MVP On Fri, 6 Oct 2006 13:41:01 -0700, Jim Thomlinson wrote: msgbox Environ("UserName") & vbcrlf & Environ("ComputerName") -- HTH... Jim Thomlinson "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Ok - thanks - so what interface are you using here - Excel or VB - I also
thought there was a KB article that would let these variables some how appear - Thanks again. BD "Jim Thomlinson" wrote: msgbox Environ("UserName") & vbcrlf & Environ("ComputerName") -- HTH... Jim Thomlinson "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Gord,
Thanks for the information, but how do you do this? This all has to be silent behind the scenes stuff which I didn't mention. The reason for the request is we have over 1000 machines and we are trying to determine which notebooks have a recalled battery. We have an application that will dump the information to a .csv file and I can use the information there, but it only provides the serial number of the machine and battery - it also provides a "Y" or "N" and only Sony batteries are being recalled. So I have been using ..bat and .cmd files to push this app to the notebook, using the set command and capture the computername and username in one file and then save it to a server, but without the username and computername in the file but when the file is created, I user %username%%computername%.csv as the file name - I don't want to have to key in 1000 computername and usernames into the .csv. If this makes sense, I would appreciate any better way to handle this. Thanks in advance. BD "Gord Dibben" wrote: BD Try this little "pulled off the groups" goodie to get a whack of stuff in a message box. Sub LISTENVIRON() Dim new_value As String Dim Txt As String Dim i As Integer 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 & "UserName = " & Application.UserName & vbCrLf 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 Workbook Name = " & Application.ActiveWorkbook.Name MsgBox Txt End Sub Gord Dibben MS Excel MVP Gord Dibben MS Excel MVP On Fri, 6 Oct 2006 13:41:01 -0700, Jim Thomlinson wrote: msgbox Environ("UserName") & vbcrlf & Environ("ComputerName") -- HTH... Jim Thomlinson "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks for the information, but how do you do this? This all has to be
silent behind the scenes stuff which I didn't mention. The reason for the request is we have over 1000 machines and we are trying to determine which notebooks have a recalled battery. We have an application that will dump the information to a .csv file and I can use the information there, but it only provides the serial number of the machine and battery - it also provides a "Y" or "N" and only Sony batteries are being recalled. So I have been using ..bat and .cmd files to push this app to the notebook, using the set command and capture the computername and username in one file and then save it to a server, but without the username and computername in the file but when the file is created, I user %username%%computername%.csv as the file name - I don't want to have to key in 1000 computername and usernames into the .csv. If this makes sense, I would appreciate any better way to handle this. Thanks in advance. BD "Kevin B" wrote: you can get the username using VBA with the following command application.UserName To the best of my knowledge, for other system variables you'll have to do a Windows API call -- Kevin Backmann "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks for the information, but how do you do this? This all has to be
silent behind the scenes stuff which I didn't mention. The reason for the request is we have over 1000 machines and we are trying to determine which notebooks have a recalled battery. We have an application that will dump the information to a .csv file and I can use the information there, but it only provides the serial number of the machine and battery - it also provides a "Y" or "N" and only Sony batteries are being recalled. So I have been using ..bat and .cmd files to push this app to the notebook, using the set command and capture the computername and username in one file and then save it to a server, but without the username and computername in the file but when the file is created, I user %username%%computername%.csv as the file name - I don't want to have to key in 1000 computername and usernames into the .csv. If this makes sense, I would appreciate any better way to handle this. Thanks in advance. BD "Jim Thomlinson" wrote: msgbox Environ("UserName") & vbcrlf & Environ("ComputerName") -- HTH... Jim Thomlinson "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Looks to me that you should modify the way you create your CSV file to
include the informations you need into it. You are saying it is created from a BAT file ? Post the BAT file content if possible... -- Festina Lente "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
#10
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How many CSV files do you have ?
Do you combine them into one file ? A simple command line could combine them into one file and include the filenames into it... -- Festina Lente "bdickert" wrote: I am trying to capture information into an Excel Spreadsheet specifically a couple of System Environment Variables like Computername, Username, etc. Is this possible? Please explain if this is possible. Thanks in advance. BD |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
System Environment Variables | Excel Discussion (Misc queries) | |||
RE-submitting of: constructing (complex) variables with worksheet functions | Excel Worksheet Functions | |||
VBA reseting variables | Excel Discussion (Misc queries) | |||
VBA reseting variables | Excel Discussion (Misc queries) | |||
Microsoft should put operating system on hardware not software | Excel Discussion (Misc queries) |