Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
audit trail | Excel Discussion (Misc queries) | |||
change audit | Excel Programming | |||
Model Audit | Excel Programming | |||
Worksheet audit | Excel Programming | |||
Audit Programme | Excel Programming |