Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get Hard Drive Serial Number by Manufacturer with VBA 4

Status
Not open for further replies.

nitin36537

Civil/Environmental
Feb 16, 2001
60
How to get the Hard Drive Serial Number given by the Manufacturer with VBA?

Please note that I need Number given by Manufacturer & not Hard drive serial number which is a random number that is generated by DOS or Windows every time you format your hard drive.

Thanks
 
Replies continue below

Recommended for you

Code:
MSGBOX ("Please save your work, turn off the computer, open the case, write down the serial number of the hard drive, reinstall the case, start up the computer and restart this application.")

 
Dear MintJulep

I want to read that number through Excel VBA.

Thanks
 
Dear nitin36537

I can't be sure, but I think MintJulep may have been making a little joke.


Your question is answered in the other thread.

Doug Jenkins
Interactive Design Services
 
There are freeware utilities that find the hard disc ID. Maybe you can activate them through Excel and extract the ID.
 
IDS said:
I can't be sure, but I think MintJulep may have been making a little joke.
It made me laugh; if it was a joke, well done MintJulep!
If it wasn't a joke, well done anyway.

(no, the star wasn't from me)
 
Doug,
From the other thread:
There is some code buried in the discussion here: have re-written it to work as an Excel UDF:
I have tried this and failed (see attached)..
If you have the time, could you help?

[link ]
btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Clyde's profile on LinkedIn
[/url]
 
Clyde - your file works on my computer with no problems (Excel 2010 and Windows7), after enabling macros.

I have attached a screenshot showing the referneces I have running (Tools-references in the VB Editor). Check you have all of those enabled.

Another possible problem might be if you are not running as administrator.

Other than that I can only suggest following the discussions linked previously and see if anyone has had the same problem, or try one of the other solutions.

Please let us know if you get it fixed or not.

Doug Jenkins
Interactive Design Services
 
IDS's UDF works fine for me as well, using Excel 2002 on Win-XP.

(However. I have made a small spreadsheet that incorporates the UDF in a code module. When I take that spreadsheet to a new computer and load it up, the new disk serial number does not come up automatically. Nor does it come up if I hit <F9>. I have to actually "edit" the cell that contains the call to the UDF to get the new serial number appearing. It seems that the UDF is somehow slipping through Excel's normal recalc logic.)
 
I think the reference to the Office Object Library and/or the Excel Object Library are probably the key things to ensuring it works.

Beacuse it doesn't have any parameters it won't be in the recalc loop. Either entering edit mode (press F2 with the function cell selected) then enter, or Ctrl-Alt-F9 to do a full recalc should make it update.

Doug Jenkins
Interactive Design Services
 
Doug,
Thanks, I'm using Windows XP and Excel 2007. I do have all of the references enabled. I do not have administrative privliges on this PC. I'll check at home or have our administrator try it here.

[link ]
btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Clyde's profile on LinkedIn
[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor