LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Execute program (macro?) upon opening a workbook

Thanks Nicky. I will try what you recommend
The reason I want to record the last used date and check against it is to secure against people temporarily setting back the date on their computer
-Warre

----- Nicky wrote: ----

H
you will need to run a macro on opening, and also one on closing tha
saves the file automatically if you want to record the time of the mos
recent access (though I'm not sure why - won't the time now always b
after the time the file was last accessed?).

the auto-open and auto_close macros run automatically whenever the fil
opens and closes. The attached sheet includes a sort of worked example
with the sheet named "hid" containing data you would hide, and th
macros running to check dates on opening, then closing if the expir
date has passed unless the correct passwor "excelforum" is entered

The macros are

Sub AUTO_OPEN(
If Date Sheets("hid").Range("expiry_date").Value The
resp = InputBox("sorry, your trial has expired." & Chr(10) & "You mus
enter a password to continue working in this workbooket", "Ente
password", resp
If LCase(resp) < LCase(Sheets("hid").Range("password").Value) The
ActiveWorkbook.Clos
End I
End Su

Sub AUTO_Close(
Sheets("hid").Range("last_opened").Value = Now(
Sheets("hid").Range("times_opened").Value = 1
Sheets("hid").Range("times_opened").Valu
If ActiveWorkbook.Saved = False Then ActiveWorkbook.Sav
End Su

Attachment filename: test.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=44732
--
Message posted from http://www.ExcelForum.com


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a Workbook with a Macro Eli[_4_] Excel Discussion (Misc queries) 4 October 3rd 08 12:13 AM
Execute macro at opening file clippan New Users to Excel 1 November 26th 05 10:03 AM
Run macro when opening workbook nsv Excel Discussion (Misc queries) 4 September 6th 05 12:19 PM
macro to start on workbook opening Nigel Excel Discussion (Misc queries) 1 May 13th 05 12:39 PM
execute external program when cell reaches certain value Brendan DJ Murphy Excel Worksheet Functions 0 February 16th 05 05:25 PM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"