I didn't see any place that actually closed the workbook
I added "Thisworkbook.Close False" below and it seems ok
Be advised that this can be easily circumvented
Option Explicit
Dim dteExpiry As Date 'Declare variables
Dim flagLocked As String
Dim strPWD As String
Dim strResult As String
Sub Auto_open()
Sheets("Welcome").Visible = True
Sheets("Main").Visible = xlVeryHidden 'Can't be unhidden by the user
Sheets("Defaults").Visible = xlVeryHidden
dteExpiry = Sheets("Defaults").Cells(1, 2).Value ' Test for Expiry
strPWD = Sheets("Defaults").Cells(2, 2).Value
flagLocked = Sheets("Defaults").Cells(3, 2).Value
If dteExpiry < Now() And flagLocked = "No" Then 'Trial period over
flagLocked = "Yes"
Sheets("Defaults").Cells(3, 2) = flagLocked
ActiveWorkbook.Save 'Ensures that flagLocked is set
MsgBox "The trial period has expired. Please contact xxxx at yyyyy"
ThisWorkbook.Close False
'Application.Quit
ElseIf flagLocked = "Yes" Then
strResult = InputBox("Enter password", "Password", vbOKCancel)
If strResult = strPWD Then
Sheets("Main").Visible = True 'Reveal the "Main" sheet
Sheets("Welcome").Visible = False
Else
MsgBox "The password is wrong. Please contact xxxx at yyyyy"
ThisWorkbook.Close False
'Application.Quit
End If
Else 'Within trial period
Sheets("Main").Visible = True
Sheets("Main").Select
Sheets("Welcome").Visible = False
End If
End Sub
Sub Auto_Close()
Sheets("Welcome").Visible = True
Sheets("Main").Visible = xlVeryHidden
Sheets("Defaults").Visible = xlVeryHidden
ActiveWorkbook.Save
End Sub