Help with get hdd serial code

Gregm66

Board Regular
Joined
Jan 23, 2016
Messages
170
Hi all,

i have code to get my hdd serial number then code in the Workbook Open, this works fine although what i am wanting to do is have this code check the hdd number and display a msgbox that says hdd serial verified, and also show another msgbox that says serial number not valid then shuts the workbook is this possible. as it is it just closes the workbook if the serial number doesnt match..please see my code below...this code is in the workbook open.


Code:
If CreateObject("Scripting.FileSystemObject").GetDrive("C:\").SerialNumber <> "1012000350" Then Application.Quit
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try this

Code:
  If CreateObject("Scripting.FileSystemObject").GetDrive("C:\").SerialNumber <> "1012000350" Then
    MsgBox "Serial number not valid", vbCritical, "Bye"
    Application.Quit
  Else
    MsgBox "hdd serial verified", vbInformation, "Hello"
  End If
 
Upvote 0
Hi DanteAmor,
Appologise for my late reply, i will try the code and let you know, once again i thankyou for your help and reply.
 
Upvote 0
Thankyou DanteAmor,
I have just used the code and it functions perfectly.. Thankyou again for you help muchly appreciated..
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,568
Messages
6,114,348
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top