473,322 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Excel VBA: how to get a file expired after 30 days unless a password is entered

Hi Thanks for reading and helping me out in this in advance.

I have designed a training tool that mimics(dummy copy of) very secure financial system. Using this tool we train the new staff so that our main system stay secure and we feel safe giving details to new joiners.

Its in excel VBA.

I have following code in workbook_open event

sub workbook_open()
application.windowstate = xlminimize
userform1.show.
end sub

once userform1 comes up, depending on users responses further next userforms load and unload eventually, and we can deliver the whole lot of training giving a feel of real systems to delegates.

However I want to do the following.

I send this training tool to new joiners as an email attachment, so each one of them have a copy of this 2MB .xls file.
they use it during 4 weeks training.

But i dont have any ways to stop them from : using it or having a look at it or potentially taking my screenshots prints home or plot a fraud after the training is finished

I want that my first userform will stop loading up after exactly 30 days for that particular user but it will come up if an administrator password will be entered.

I am using the following code for that....
this is a macro in module 1

Sub expire()
Static DateOpened As Date
Static Check As Boolean
If Check = False Then
Check = True
DateOpened = now
'DateOpened = 37677
End If
If Now - DateOpened > 30 Then
MsgBox "This workbook has expired", vbCritical + vbOKOnly, "Expired"
Application.Quit
Else
userform1.Show
End If
End Sub

and then in above code for workbook_open event

sub workbook_open()
application.windowstate = xlminimize
if inputbox("please enter access password") = "rinuk" then
module1.expire
else MsgBox "This workbook has expired", vbCritical + vbOKOnly, "Expired"
Application.Quit
endif
end sub


which works fine, but its applicable to all users and even to copies of that file.

I want it to expire after 30 days for that particular user, unless he knows admin password (rinuk)
However if that user sends the file to someone else, it should let new user to use it for more 30 days..

those who (about 20 people) will know the admin password (rinuk) will be able to use it forever.

hope i have explained properly. please reply if you need more information.

Your help is greatly appreciated.

thanks
Mar 2 '10 #1
1 6117
resolved,
thanks


-rinuk
Mar 19 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Simon.Cullen | last post by:
Hi all. I am doing some Excel VBA programming for an engineering group in the area of production scheduling. Most of it is going OK but they have some ideas for a bit of a dream tool. Eventually...
2
by: Jon Spragg | last post by:
Hi, I am running an Excel Application that uses a Control Button to invoke a java application that performs some computation and writes the results to a text file. The VB code behind the...
1
by: chris_j_adams | last post by:
Hi, I'm trying to use Excel VBA ('97) to send details from an Excel sheet to a web page. I'm having some success but I've one issue that's proved difficult to find in the archives. There are...
1
by: Paul | last post by:
Dear all, I am trying to create a DLL in C# and try to invoke the DLL from my excel VBA code. This may not be a purely C# problem, since I am not sure whether I have done something wrong with...
3
by: bennyad | last post by:
hi all, i've created an Excel VBA script that shows UserForm1 when clicking on close (the "X" at the top right) without saving. the form simply prompts the user whether to save the file or not...
76
by: JFKJr | last post by:
Hi, the following Excel VBA code is used to select 5 rows by double clicking the cell in the first column corresponding to that row. The code is working fine in excel. But, I need Access VBA code,...
17
by: Blaine | last post by:
I've created the following dll in vb 2008. ___________________________________________________________ Public Interface IDemo Sub doSomething() End Interface Public Class implementIDemo...
0
by: Art Altman | last post by:
I have found a workaround to the Excel VBA “ run time error 40036 application-defined or object error”. It does not fix the original problem, which is in excel, SOMEWHERE. A few responses I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.