Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-16-2018, 08:23 PM
Logit Logit is offline Excel file related to cpu and date on computer Windows 10 Excel file related to cpu and date on computer Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

This macro will obtain the Hard Drive serial number :

Code:
Option Explicit

Sub GetPhysicalSerial()
 
Dim obj As Object
Dim WMI As Object
 
Set WMI = GetObject("WinMgmts:")
 
For Each obj In WMI.InstancesOf("Win32_PhysicalMedia")
MsgBox "SN: " & obj.SerialNumber
Next
 
End Sub
This code is for a Visual Basic Script file. It obtains the machine serial number.

Code:
 strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_ComputerSystemProduct") 
For Each objItem in colItems 
    msgbox "This Device: " & objItem.IdentifyingNumber, vbOkayOnly, "Serial Number"
Next
Paste the code into NOTEPAD, then save it as Serial Number.vbs

If you are sending your project to a customer, you can send the customer both of these files first. Request the customer run the files and send you the information that is obtained. Then you can utilize that information in your macro code to verify it is running on the correct machine. You would do this the same way as you would be checking for a password.

This macro will time limit the use of the workbook, advising the user how many days they have left before it expires.



Code:
Option Explicit

Sub EndSplash()
    Dim exdate As Date
    UserForm1.Hide
    exdate = "11/27/2018"      '<---- Uncomment and add expire date !!!!!!!!!!!!!!!
    If Date > exdate Then
        MsgBox ("End of your trail period! Contact to Theikdi Maung")
        ActiveWorkbook.Close
    End If
    MsgBox ("You have " & exdate - Date & " Days left")
End Sub
The attached file is the sample workbook for you to review.
Attached Files
File Type: xlsm Time Bomb.xlsm (23.8 KB, 15 views)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel file related to cpu and date on computer HELP! Computer crashed, no recovery file, old versions, etc and file was open for over 24 hours! matthew.coppedge Word 2 04-07-2016 09:01 PM
Please answer my question related to MS Excel 2007. Part 6. MonkiaSaini Excel 1 05-30-2010 12:02 PM
Please answer my question related to MS Excel 2007. Part 4. MonkiaSaini Excel 0 05-09-2010 04:19 AM
Please answer my question related to MS Excel 2007. Part 3. MonkiaSaini Excel 0 05-09-2010 04:17 AM
Please answer my question related to MS Excel 2007. Part 2. MonkiaSaini Excel 0 05-09-2010 04:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft