Hi all
I have excel file that a little computer can open it, according to HDD serialnumber (C:\)
Code belove can't run, please fix it. I'm not good at VBA code
Thanks./.
I have excel file that a little computer can open it, according to HDD serialnumber (C:\)
Code belove can't run, please fix it. I'm not good at VBA code
Thanks./.
Code:
Private Sub Workbook_Open()Dim oFSO As Object, drive As Variant, driveC As Variant
Set oFSO = CreateObject("Scripting.FileSystemObject").GetDrive("C:\")
Set drive.Value = oFSO.serialnumber.Value
With Sheets("Username")
driveC = .Range("A1").Value
End With
If Not Application.Match(driveC, drive, 0) Then
MsgBox "Hallo " & Environ("UserName")
Application.Quit
Else
MsgBox "Wellcome " & Environ("UserName")
End If
End Sub