Auto_Open macro: read-only after expiry?

Dirty Laundry

New Member
Joined
Jan 17, 2009
Messages
33
Hello - I am looking for assistance with my Auto_Open macro. Currently it forces the workbook closed after a designated expiration date. I'm trying to alter it so that users have read-only access to the workbook after it expires, rather than forcing it closed. Any suggestions would be greatly appreciated. Thanks! - DL

Code:
Sub Auto_Open()
'
' AutoOpenDGF Macro
'
Dim exdate As Date
    exdate = "01/17/2012"
    If Date > exdate Then
        MsgBox ("-- W A R N I N G --" & vbCr & vbCr & "This workbook expired on 01/17/2012." & vbCr & vbCr & "Please obtain the current version.")
        ActiveWorkbook.Close
    End If
    MsgBox ("-- N O T I C E --" & vbCr & vbCr & "This workbook will expire in (" & exdate - Date & ") days.")
'
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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