Thread
:
Expiry of MS Excel file
View Single Post
#
9
Posted to microsoft.public.excel.misc
Som
external usenet poster
Posts: 26
Expiry of MS Excel file
My code----
=====================
Private Sub Workbook_Open()
MsgBox "Ok"
MsgBox DateDiff("d", "10/Mar/2009", Date)
If DateDiff("d", "10/Mar/2009", Date) < 1 Then
MsgBox "Ok1"
Application.ActiveWorkbook.Close
End If
MsgBox "Ok2"
End Sub
======================================
result of manual run of MS
VB
macro
msg box ok coming
msg box 2 coming
msg box ok1 not coming
msg box ok2 coming
how to run the macro automatically
"Som" wrote:
No boss, it is not working.....!!!!!!!!
how this macro will run ? auto? i think there is some problem
my mail id is
can u pls send me atest mail , so that i can send u the file with i have
done...
"Jacob Skaria" wrote:
Sorry, this should be....
If DateDiff("d","12/Mar/2009",Date) < 1
JacobSkaria
"Som" wrote:
No ,
it is not working...!!!!!!
I've given 11 march 2009
but it is openning......!!!!!!
one thing , I want to inform that here in my office by default MS Excel
Macro Security is 'VERY HIGH'.....
is this creating the problem?
*** how to give different password in MS Excel
VB
editor?
"Jacob Skaria" wrote:
Hi Som
You need write a piece of code. From the menu go to
Tools--Macro--Visual Basic Editor--
Select Worksheet and copy the below code
Private Sub Workbook_Open()
If DateDiff("d","12/Mar/2009",Date) < -1 Then
Application.ActiveWorkbook.Close
End If
End Sub
This will only allow the workbook to be used upto Mar 12th. Password protect
the Visual Basic Editor before you distribute.
Jacob Skaria
(If this post is helpful please click Yes)
Reply With Quote
Som
View Public Profile
Find all posts by Som