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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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

Forum statistics

Threads
1,223,693
Messages
6,173,874
Members
452,536
Latest member
Chiz511

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