Auto run a macro when a date/time has occured - any thoughts?

G

Guest

Hi, I'm new to the board, I humbly ask for your acceptance... I work as a
cost estimator and have developed a very, very nice program to calculate the
selling price of our products. It incorporates Escalation, all direct labor
rates and overhead rates, is capable of time shifting to forward dates and
mid-points and so on. I have been "asked" by some of the people I answer to
for copies of this program, but I hesitate. If not all the adjustments are
kept up to date, the information can be eronious - and we all know "who will
be to blame" for eronious information. Here is what I want to do. I want to
have a macro that will delete all the pages then save the new file over top
of the old file. And if they have another copy - again, upon opening it, and
the statement seeing that the date has been passed - again activate the
macro. - forcing them to come back to me for another - which would be the
latest and greatest, right?
any thoughts? - Cheers to you all - and thanks for being here.
 
G

Guest

Here's a place to start, and there may be better solutions. Place the code in
a module. It will run each time the workbook is opened. If the exDate matches
the computers system date a message box is displayed and the the workbook is
closed.

Hal

Sub Auto_Open()
Dim exDate As Date, curDate As Date
exDate = DateSerial(2005, 10, 18)
curDate = Date
If curDate >= exDate Then
MsgBox ("Get updated file from HW42!")
ThisWorkbook.Close SaveChanges:=False
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top