Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Laptop Audit

Hi,

A colleague is trying to do an audit of our company's laptops - I can get
processor information, computer name etc from Environ(x), but is there a way
to get the make & model of a computer?

Cheers,

Sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Laptop Audit

You can get that information from the system registry. The values are
stored in HKEY_LOCAL_MACHINE\Hardware\Description\System\Bio s. To see
these values manually, enter RegEdit into the Run dialog on the
Windows Start menu and expand the tree view nodes to display the
values.

For programmatic access.....

Download the following zip files:

http://www.cpearson.com/Zips/modRegistry.zip
http://www.cpearson.com/Zips/modFormatMessage.zip

Unzip these files to some folder. Then, in VBA, go to the File menu,
choose "Import File", navigate to the folder in which the files were
unzipped, and import modRegistry.bas and modFormatMessage.bas. This
will create two modules in your project: modRegistry, which wraps up
all Windows API functions for registry access into nice VBA-friendly
procedures; and modFormatMessage, which gets the text description of
any API errors that might occur.

With these modules, you can use code like:

Function GetSysManufacturer() As String
' http://www.cpearson.com/Zips/modRegistry.zip
' http://www.cpearson.com/Zips/modFormatMessage.zip
Dim Value As Variant
Value = RegistryGetValue(HKLM, _
"Hardware\Description\System\Bios", _
"SystemManufacturer")
If IsNull(Value) = True Then
GetSysManufacturer = vbNullString
Else
GetSysManufacturer = CStr(Value)
End If
End Function

Function GetSysProductName() As String
' http://www.cpearson.com/Zips/modRegistry.zip
' http://www.cpearson.com/Zips/modFormatMessage.zip
Dim Value As Variant
Value = RegistryGetValue(HKLM, _
"Hardware\Description\System\Bios", _
"SystemProductName")
If IsNull(Value) = True Then
GetSysProductName = vbNullString
Else
GetSysProductName = CStr(Value)
End If
End Function

Sub AAA()
Dim SysMfg As String
Dim SysModel As String
SysMfg = GetSysManufacturer()
SysModel = GetSysProductName()
Debug.Print SysMfg, SysModel
End Sub

The AAA procedure shows how to get the values and writes them to the
Immediate window.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 22 Sep 2009 01:43:01 -0700, Sam Wilson
wrote:

Hi,

A colleague is trying to do an audit of our company's laptops - I can get
processor information, computer name etc from Environ(x), but is there a way
to get the make & model of a computer?

Cheers,

Sam

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Laptop Audit

Thanks Chip,

I can get what I need from that, but just so you know

http://www.cpearson.com/Zips/modFormatMessage.zip

is a broken link.

Thanks again!

"Chip Pearson" wrote:

You can get that information from the system registry. The values are
stored in HKEY_LOCAL_MACHINE\Hardware\Description\System\Bio s. To see
these values manually, enter RegEdit into the Run dialog on the
Windows Start menu and expand the tree view nodes to display the
values.

For programmatic access.....

Download the following zip files:

http://www.cpearson.com/Zips/modRegistry.zip
http://www.cpearson.com/Zips/modFormatMessage.zip

Unzip these files to some folder. Then, in VBA, go to the File menu,
choose "Import File", navigate to the folder in which the files were
unzipped, and import modRegistry.bas and modFormatMessage.bas. This
will create two modules in your project: modRegistry, which wraps up
all Windows API functions for registry access into nice VBA-friendly
procedures; and modFormatMessage, which gets the text description of
any API errors that might occur.

With these modules, you can use code like:

Function GetSysManufacturer() As String
' http://www.cpearson.com/Zips/modRegistry.zip
' http://www.cpearson.com/Zips/modFormatMessage.zip
Dim Value As Variant
Value = RegistryGetValue(HKLM, _
"Hardware\Description\System\Bios", _
"SystemManufacturer")
If IsNull(Value) = True Then
GetSysManufacturer = vbNullString
Else
GetSysManufacturer = CStr(Value)
End If
End Function

Function GetSysProductName() As String
' http://www.cpearson.com/Zips/modRegistry.zip
' http://www.cpearson.com/Zips/modFormatMessage.zip
Dim Value As Variant
Value = RegistryGetValue(HKLM, _
"Hardware\Description\System\Bios", _
"SystemProductName")
If IsNull(Value) = True Then
GetSysProductName = vbNullString
Else
GetSysProductName = CStr(Value)
End If
End Function

Sub AAA()
Dim SysMfg As String
Dim SysModel As String
SysMfg = GetSysManufacturer()
SysModel = GetSysProductName()
Debug.Print SysMfg, SysModel
End Sub

The AAA procedure shows how to get the values and writes them to the
Immediate window.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 22 Sep 2009 01:43:01 -0700, Sam Wilson
wrote:

Hi,

A colleague is trying to do an audit of our company's laptops - I can get
processor information, computer name etc from Environ(x), but is there a way
to get the make & model of a computer?

Cheers,

Sam


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
audit trail MIke Excel Discussion (Misc queries) 4 February 27th 08 12:11 AM
change audit Gary Brown Excel Programming 0 June 7th 05 08:09 PM
Model Audit ExcelMonkey[_190_] Excel Programming 2 February 1st 05 01:52 PM
Worksheet audit Dr.Schwartz Excel Programming 2 January 31st 05 11:35 AM
Audit Programme Steved[_3_] Excel Programming 6 September 7th 04 01:58 AM


All times are GMT +1. The time now is 10:59 AM.

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

About Us

"It's about Microsoft Excel"