View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
CellShocked CellShocked is offline
external usenet poster
 
Posts: 277
Default how to detect host id of a computer using excel

On Sat, 05 Jan 2013 14:05:33 -0500, GS wrote:

try...

Private Function Get_BIOSserialNum() As String
' Gets the serial number of a PC's BIOS
Dim oWMI As Variant, vSettings As Variant, vBIOS As Variant

Const sComputer$ = _
"winmgmts:{impersonationLevel=impersonate}!\\.\roo t\cimv2"
Set oWMI = CreateObject(sComputer)
Set vSettings = oWMI.ExecQuery("Select * from Win32_BIOS")
For Each vBIOS In vSettings
Get_BIOSserialNum = Trim(vBIOS.SerialNumber): Next
End Function '//Get_BIOSserialNum

..note, though, that some clones won't have a serial number and so
you'll need to handle what to do in this case.



Where do I place a private function? I have not previously ever
defined one.

So far, the macro area of my worksheet does not do it.

And how do I call it? no arguments, right? Just =call() in the
cell and it resolves?

So far I get a name error. I have yet to place it in the right
location so that it shows up in the function list.