Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Show amount of RAM and Windows OS?

Is it possible to read and show the amount of system RAM and which version
of the Windows OS being used (98, ME, XP, Vista, etc...)??

Anyone who can cook up a VBA code for this?


Thanks...




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Show amount of RAM and Windows OS?

Are you familiar with VBA? Run this code:
Sub SysInfo()

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")


With Sheets(1)

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem In colSettings

Cells(1, 1) = "OS Name: "
Cells(1, 2) = objOperatingSystem.Name

Cells(2, 1) = "Version: "
Cells(2, 2) = objOperatingSystem.Version

Cells(3, 1) = "Service Pack: "
Cells(3, 2) = objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion

Cells(4, 1) = "OS Manufacturer: "
Cells(4, 2) = objOperatingSystem.Manufacturer

Cells(5, 1) = "Windows Directory: "
Cells(5, 2) = objOperatingSystem.WindowsDirectory

Cells(6, 1) = "Locale: "
Cells(6, 2) = objOperatingSystem.Locale

Cells(7, 1) = "Available Physical Memory: "
Cells(7, 2) = objOperatingSystem.FreePhysicalMemory

Cells(8, 1) = "Total Virtual Memory: "
Cells(8, 2) = objOperatingSystem.TotalVirtualMemorySize

Cells(9, 1) = "Available Virtual Memory: "
Cells(9, 2) = objOperatingSystem.FreeVirtualMemory

Cells(10, 1) = "Size stored in paging files: "
Cells(10, 2) = objOperatingSystem.SizeStoredInPagingFiles

Next

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer In colSettings

Cells(11, 1) = "System Name: "
Cells(11, 2) = objComputer.Name

Cells(12, 1) = "System Manufacturer: "
Cells(12, 2) = objComputer.Manufacturer

Cells(13, 1) = "System Model: "
Cells(13, 2) = objComputer.Model

Cells(14, 1) = "Total Physical Memory: "
Cells(14, 2) = objComputer.TotalPhysicalMemory

Next

End With

End Sub

Regards,
Ryan---

--
RyGuy


"Charlotte E." wrote:

Is it possible to read and show the amount of system RAM and which version
of the Windows OS being used (98, ME, XP, Vista, etc...)??

Anyone who can cook up a VBA code for this?


Thanks...





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Show amount of RAM and Windows OS?

Are you familiar with VBA?

Still learning :-)


Run this code


Work - thanks :-)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Show amount of RAM and Windows OS?

What does the system information, "Locale", means (mine says 406)?



"ryguy7272" skrev i en meddelelse
...
Are you familiar with VBA? Run this code:
Sub SysInfo()

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")


With Sheets(1)

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem In colSettings

Cells(1, 1) = "OS Name: "
Cells(1, 2) = objOperatingSystem.Name

Cells(2, 1) = "Version: "
Cells(2, 2) = objOperatingSystem.Version

Cells(3, 1) = "Service Pack: "
Cells(3, 2) = objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion

Cells(4, 1) = "OS Manufacturer: "
Cells(4, 2) = objOperatingSystem.Manufacturer

Cells(5, 1) = "Windows Directory: "
Cells(5, 2) = objOperatingSystem.WindowsDirectory

Cells(6, 1) = "Locale: "
Cells(6, 2) = objOperatingSystem.Locale

Cells(7, 1) = "Available Physical Memory: "
Cells(7, 2) = objOperatingSystem.FreePhysicalMemory

Cells(8, 1) = "Total Virtual Memory: "
Cells(8, 2) = objOperatingSystem.TotalVirtualMemorySize

Cells(9, 1) = "Available Virtual Memory: "
Cells(9, 2) = objOperatingSystem.FreeVirtualMemory

Cells(10, 1) = "Size stored in paging files: "
Cells(10, 2) = objOperatingSystem.SizeStoredInPagingFiles

Next

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer In colSettings

Cells(11, 1) = "System Name: "
Cells(11, 2) = objComputer.Name

Cells(12, 1) = "System Manufacturer: "
Cells(12, 2) = objComputer.Manufacturer

Cells(13, 1) = "System Model: "
Cells(13, 2) = objComputer.Model

Cells(14, 1) = "Total Physical Memory: "
Cells(14, 2) = objComputer.TotalPhysicalMemory

Next

End With

End Sub

Regards,
Ryan---

--
RyGuy


"Charlotte E." wrote:

Is it possible to read and show the amount of system RAM and which
version
of the Windows OS being used (98, ME, XP, Vista, etc...)??

Anyone who can cook up a VBA code for this?


Thanks...







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Show amount of RAM and Windows OS?

It's a language code. Don't know what 406 is but 409 is US English

Just a heads up about winmgmts, it might fail (ie error) in win98 if not
installed, which it isn't by default as it is in later OS. If that's a
potential concern there are API methods.

Regards,
Peter T


"Charlotte E." wrote in message
...
What does the system information, "Locale", means (mine says 406)?



"ryguy7272" skrev i en meddelelse
...
Are you familiar with VBA? Run this code:
Sub SysInfo()

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")


With Sheets(1)

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem In colSettings

Cells(1, 1) = "OS Name: "
Cells(1, 2) = objOperatingSystem.Name

Cells(2, 1) = "Version: "
Cells(2, 2) = objOperatingSystem.Version

Cells(3, 1) = "Service Pack: "
Cells(3, 2) = objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion

Cells(4, 1) = "OS Manufacturer: "
Cells(4, 2) = objOperatingSystem.Manufacturer

Cells(5, 1) = "Windows Directory: "
Cells(5, 2) = objOperatingSystem.WindowsDirectory

Cells(6, 1) = "Locale: "
Cells(6, 2) = objOperatingSystem.Locale

Cells(7, 1) = "Available Physical Memory: "
Cells(7, 2) = objOperatingSystem.FreePhysicalMemory

Cells(8, 1) = "Total Virtual Memory: "
Cells(8, 2) = objOperatingSystem.TotalVirtualMemorySize

Cells(9, 1) = "Available Virtual Memory: "
Cells(9, 2) = objOperatingSystem.FreeVirtualMemory

Cells(10, 1) = "Size stored in paging files: "
Cells(10, 2) = objOperatingSystem.SizeStoredInPagingFiles

Next

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer In colSettings

Cells(11, 1) = "System Name: "
Cells(11, 2) = objComputer.Name

Cells(12, 1) = "System Manufacturer: "
Cells(12, 2) = objComputer.Manufacturer

Cells(13, 1) = "System Model: "
Cells(13, 2) = objComputer.Model

Cells(14, 1) = "Total Physical Memory: "
Cells(14, 2) = objComputer.TotalPhysicalMemory

Next

End With

End Sub

Regards,
Ryan---

--
RyGuy


"Charlotte E." wrote:

Is it possible to read and show the amount of system RAM and which
version
of the Windows OS being used (98, ME, XP, Vista, etc...)??

Anyone who can cook up a VBA code for this?


Thanks...











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Show amount of RAM and Windows OS?

It's a language code. Don't know what 406 is but 409 is US English

Anyone know where to find a list of those language codes???
406 must mean Danish then :-)

If anyone uses another language version of Excel, please, post your Locale
code here - I'm particular interested in Dutch, Polish, Russian and
Ukrainian.



Just a heads up about winmgmts, it might fail (ie error) in win98 if
not installed, which it isn't by default as it is in later OS. If
that's a potential concern there are API methods.


Thanks for the heads up - I'll re-write the code to handle if an error occur
when using "WiNMgmts" - thanks...





Regards,
Peter T


"Charlotte E." wrote in message
...
What does the system information, "Locale", means (mine says 406)?



"ryguy7272" skrev i en
meddelelse ...
Are you familiar with VBA? Run this code:
Sub SysInfo()

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")


With Sheets(1)

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem In colSettings

Cells(1, 1) = "OS Name: "
Cells(1, 2) = objOperatingSystem.Name

Cells(2, 1) = "Version: "
Cells(2, 2) = objOperatingSystem.Version

Cells(3, 1) = "Service Pack: "
Cells(3, 2) = objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion

Cells(4, 1) = "OS Manufacturer: "
Cells(4, 2) = objOperatingSystem.Manufacturer

Cells(5, 1) = "Windows Directory: "
Cells(5, 2) = objOperatingSystem.WindowsDirectory

Cells(6, 1) = "Locale: "
Cells(6, 2) = objOperatingSystem.Locale

Cells(7, 1) = "Available Physical Memory: "
Cells(7, 2) = objOperatingSystem.FreePhysicalMemory

Cells(8, 1) = "Total Virtual Memory: "
Cells(8, 2) = objOperatingSystem.TotalVirtualMemorySize

Cells(9, 1) = "Available Virtual Memory: "
Cells(9, 2) = objOperatingSystem.FreeVirtualMemory

Cells(10, 1) = "Size stored in paging files: "
Cells(10, 2) = objOperatingSystem.SizeStoredInPagingFiles

Next

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer In colSettings

Cells(11, 1) = "System Name: "
Cells(11, 2) = objComputer.Name

Cells(12, 1) = "System Manufacturer: "
Cells(12, 2) = objComputer.Manufacturer

Cells(13, 1) = "System Model: "
Cells(13, 2) = objComputer.Model

Cells(14, 1) = "Total Physical Memory: "
Cells(14, 2) = objComputer.TotalPhysicalMemory

Next

End With

End Sub

Regards,
Ryan---

--
RyGuy


"Charlotte E." wrote:

Is it possible to read and show the amount of system RAM and which
version
of the Windows OS being used (98, ME, XP, Vista, etc...)??

Anyone who can cook up a VBA code for this?


Thanks...



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Show amount of RAM and Windows OS?

I couldn't find an MS page with those language codes, I guess there must be
one, but see here
http://wiki.services.openoffice.org/wiki/Languages
It appears the codes are Hex numbers


Maybe Excel can return what you need, in help see
Application.International(constant)
with xlCountryCode and xlCountrySetting
AFAIK the returned code is same as the international telephone dial code
(not sure about all countries)


You could try the following to return memory. The GlobalMemoryStatus API
will fail in sytems with +2gig and GlobalMemoryStatusEx is n/a in Win98.
Hopefully one or the other will work!

Private Type MEMORYSTATUSEX
dwLength As Long
dwMemoryLoad As Long
ullTotalPhys As Currency
ullAvailPhys As Currency
ullTotalPageFile As Currency
ullAvailPageFile As Currency
ullTotalVirtual As Currency
ullAvailVirtual As Currency
ullAvailExtendedVirtual As Currency
End Type

Private Declare Function GlobalMemoryStatusEx _
Lib "kernel32" (mseStatus As MEMORYSTATUSEX) As Long

Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Private Declare Sub GlobalMemoryStatus Lib "kernel32" ( _
lpBuffer As MEMORYSTATUS)


Sub Test()
Dim dTotPhys As Double, res As Long
Dim mem As MEMORYSTATUS
Dim MemStat As MEMORYSTATUSEX

' GlobalMemoryStatus is n/a in W98, calling it will error
On Error Resume Next
MemStat.dwLength = Len(MemStat)
'If Err.Number = 0 Then
res = GlobalMemoryStatusEx(MemStat)
If res Then
dTotPhys = MemStat.ullTotalPhys * 10000& '/ (1024& * 1024)
' don't assign 2+gig to a Long
Else
' this'll error in systems with 2+Gig memory due to Long overflow
' but unlikely in a W98 system
Call GlobalMemoryStatus(mem)
dTotPhys = mem.dwTotalPhys
End If

On Error GoTo 0

Debug.Print dTotPhys, Int(dTotPhys / (1024& * 1024)) & " Meg"

End Sub

Regards,
Peter T


"Charlotte E." <@ wrote in message
...
It's a language code. Don't know what 406 is but 409 is US English


Anyone know where to find a list of those language codes???
406 must mean Danish then :-)

If anyone uses another language version of Excel, please, post your Locale
code here - I'm particular interested in Dutch, Polish, Russian and
Ukrainian.


Just a heads up about winmgmts, it might fail (ie error) in win98 if
not installed, which it isn't by default as it is in later OS. If
that's a potential concern there are API methods.


Thanks for the heads up - I'll re-write the code to handle if an error
occur when using "WiNMgmts" - thanks...



Regards,
Peter T


"Charlotte E." wrote in message
...
What does the system information, "Locale", means (mine says 406)?



<snip


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
How do I show amount of time in minutes and seconds? TitanG Excel Worksheet Functions 6 September 9th 08 01:24 AM
Need the minus amount to show txheart Excel Discussion (Misc queries) 3 April 18th 08 02:30 AM
show how much I'm over or under an amount per day for an entire w. flarunner Excel Discussion (Misc queries) 5 February 3rd 07 02:05 AM
How do I get the a large amount of text to show in merged cell? Jennifer H. Excel Discussion (Misc queries) 2 October 5th 06 08:11 PM
how do I get a formula to not show the amount but still be there monkee New Users to Excel 2 September 15th 05 06:51 PM


All times are GMT +1. The time now is 03:01 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"