Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 208
Default System Environment Variables

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 208
Default System Environment Variables

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
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
System Environment Variables bdickert Excel Discussion (Misc queries) 1 October 8th 06 08:40 PM
RE-submitting of: constructing (complex) variables with worksheet functions broer konijn Excel Worksheet Functions 0 June 13th 06 11:36 AM
VBA reseting variables Jeff Excel Discussion (Misc queries) 0 February 4th 06 08:22 PM
VBA reseting variables bpeltzer Excel Discussion (Misc queries) 0 February 4th 06 03:52 PM
Microsoft should put operating system on hardware not software Greg Weller Excel Discussion (Misc queries) 0 September 15th 05 05:11 AM


All times are GMT +1. The time now is 04:01 PM.

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"