ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Expiring/Killing Macro(s) (https://www.excelbanter.com/excel-discussion-misc-queries/125093-expiring-killing-macro-s.html)

FARAZ QURESHI

Expiring/Killing Macro(s)
 
Can I have a macro written so as to expire/discard/terminate all the macros
in the current file after a month so as to restrict anyone else taking
benefit of using the same unless I renew the date therein. However, I don't
want the existing contents of the file to be damaged.

Thanx

Mike

Expiring/Killing Macro(s)
 
One way

Private Sub Workbook_Open()
msg = "You can't run macros in this workbook"
expires = Worksheets("Sheet1").Cells(1, 1).Value + 31
If Now expires Then MsgBox (msg)
myresponse = "mypassword"
msg = "enter password"
response = InputBox(msg)
If response = myresponse Then
Worksheets("Sheet1").Cells(1, 1).Value = Now
Else
ActiveWorkbook.Close
End If

End Sub
This prevents the workbook opening 31 days after a certain date.
In this example the date you want the 31 days to run from is in A1 of sheet1
which would need to be hidden and protected. Giving the correct password
changes that date and gives a further 31 days of usage.

I'm afraid it's not very secure though.

Mike
"FARAZ QURESHI" wrote:

Can I have a macro written so as to expire/discard/terminate all the macros
in the current file after a month so as to restrict anyone else taking
benefit of using the same unless I renew the date therein. However, I don't
want the existing contents of the file to be damaged.

Thanx


FARAZ QURESHI

Expiring/Killing Macro(s)
 
Thanx Mike,

But actually what I want is that, I'm working quite good in a company due to
such macros I have created. But I don't want anyone else to take benefit of
such macros, in case I resign.

The workbook may be allowed to be opened however execution of the macros
should stop after 31 days, unless I, after entering the VBA password, modify
the date of expiration/stoppage of the macro.

"Mike" wrote:

One way

Private Sub Workbook_Open()
msg = "You can't run macros in this workbook"
expires = Worksheets("Sheet1").Cells(1, 1).Value + 31
If Now expires Then MsgBox (msg)
myresponse = "mypassword"
msg = "enter password"
response = InputBox(msg)
If response = myresponse Then
Worksheets("Sheet1").Cells(1, 1).Value = Now
Else
ActiveWorkbook.Close
End If

End Sub
This prevents the workbook opening 31 days after a certain date.
In this example the date you want the 31 days to run from is in A1 of sheet1
which would need to be hidden and protected. Giving the correct password
changes that date and gives a further 31 days of usage.

I'm afraid it's not very secure though.

Mike
"FARAZ QURESHI" wrote:

Can I have a macro written so as to expire/discard/terminate all the macros
in the current file after a month so as to restrict anyone else taking
benefit of using the same unless I renew the date therein. However, I don't
want the existing contents of the file to be damaged.

Thanx


Peo Sjoblom

Expiring/Killing Macro(s)
 
Don't know where you work but if it is in the US it would be illegal to
sabotage what is owned by the company.
Also it won't prevent anyone who has access to Google to bypass this. Excel
is not very safe except for maybe a casual user.
All VBA and sheet/workbook password can be easily cracked, the former with a
HEX editor and the latter with simple code.
File level passwords can be cracked with inexpensive software.
--


Regards,

Peo Sjoblom



"FARAZ QURESHI" wrote in message
...
Thanx Mike,

But actually what I want is that, I'm working quite good in a company due
to
such macros I have created. But I don't want anyone else to take benefit
of
such macros, in case I resign.

The workbook may be allowed to be opened however execution of the macros
should stop after 31 days, unless I, after entering the VBA password,
modify
the date of expiration/stoppage of the macro.

"Mike" wrote:

One way

Private Sub Workbook_Open()
msg = "You can't run macros in this workbook"
expires = Worksheets("Sheet1").Cells(1, 1).Value + 31
If Now expires Then MsgBox (msg)
myresponse = "mypassword"
msg = "enter password"
response = InputBox(msg)
If response = myresponse Then
Worksheets("Sheet1").Cells(1, 1).Value = Now
Else
ActiveWorkbook.Close
End If

End Sub
This prevents the workbook opening 31 days after a certain date.
In this example the date you want the 31 days to run from is in A1 of
sheet1
which would need to be hidden and protected. Giving the correct password
changes that date and gives a further 31 days of usage.

I'm afraid it's not very secure though.

Mike
"FARAZ QURESHI" wrote:

Can I have a macro written so as to expire/discard/terminate all the
macros
in the current file after a month so as to restrict anyone else taking
benefit of using the same unless I renew the date therein. However, I
don't
want the existing contents of the file to be damaged.

Thanx




Doctorjones_md

Expiring/Killing Macro(s)
 
Well Stated Peo -- when you work for a company (assuming they're paying you
diligently), all code/applications you create for them is (by virture of the
employer/employee relationship) "Intellectual Property" of the Company.
Locking them out of your code (or otherwise sabotaging the application)
would put you in dire legal jeopardy.


"Peo Sjoblom" wrote in message
...
Don't know where you work but if it is in the US it would be illegal to
sabotage what is owned by the company.
Also it won't prevent anyone who has access to Google to bypass this.
Excel is not very safe except for maybe a casual user.
All VBA and sheet/workbook password can be easily cracked, the former with
a HEX editor and the latter with simple code.
File level passwords can be cracked with inexpensive software.
--


Regards,

Peo Sjoblom



"FARAZ QURESHI" wrote in message
...
Thanx Mike,

But actually what I want is that, I'm working quite good in a company due
to
such macros I have created. But I don't want anyone else to take benefit
of
such macros, in case I resign.

The workbook may be allowed to be opened however execution of the macros
should stop after 31 days, unless I, after entering the VBA password,
modify
the date of expiration/stoppage of the macro.

"Mike" wrote:

One way

Private Sub Workbook_Open()
msg = "You can't run macros in this workbook"
expires = Worksheets("Sheet1").Cells(1, 1).Value + 31
If Now expires Then MsgBox (msg)
myresponse = "mypassword"
msg = "enter password"
response = InputBox(msg)
If response = myresponse Then
Worksheets("Sheet1").Cells(1, 1).Value = Now
Else
ActiveWorkbook.Close
End If

End Sub
This prevents the workbook opening 31 days after a certain date.
In this example the date you want the 31 days to run from is in A1 of
sheet1
which would need to be hidden and protected. Giving the correct password
changes that date and gives a further 31 days of usage.

I'm afraid it's not very secure though.

Mike
"FARAZ QURESHI" wrote:

Can I have a macro written so as to expire/discard/terminate all the
macros
in the current file after a month so as to restrict anyone else taking
benefit of using the same unless I renew the date therein. However, I
don't
want the existing contents of the file to be damaged.

Thanx






Jon Peltier

Expiring/Killing Macro(s)
 
When I left my last employer, I had no qualms about leaving all my code.
Nobody there would ever be able to figure out how to use it (and I made no
attempt to make it hard to use).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Doctorjones_md" wrote in message
...
Well Stated Peo -- when you work for a company (assuming they're paying
you diligently), all code/applications you create for them is (by virture
of the employer/employee relationship) "Intellectual Property" of the
Company. Locking them out of your code (or otherwise sabotaging the
application) would put you in dire legal jeopardy.


"Peo Sjoblom" wrote in message
...
Don't know where you work but if it is in the US it would be illegal to
sabotage what is owned by the company.
Also it won't prevent anyone who has access to Google to bypass this.
Excel is not very safe except for maybe a casual user.
All VBA and sheet/workbook password can be easily cracked, the former
with a HEX editor and the latter with simple code.
File level passwords can be cracked with inexpensive software.
--


Regards,

Peo Sjoblom



"FARAZ QURESHI" wrote in message
...
Thanx Mike,

But actually what I want is that, I'm working quite good in a company
due to
such macros I have created. But I don't want anyone else to take benefit
of
such macros, in case I resign.

The workbook may be allowed to be opened however execution of the macros
should stop after 31 days, unless I, after entering the VBA password,
modify
the date of expiration/stoppage of the macro.

"Mike" wrote:

One way

Private Sub Workbook_Open()
msg = "You can't run macros in this workbook"
expires = Worksheets("Sheet1").Cells(1, 1).Value + 31
If Now expires Then MsgBox (msg)
myresponse = "mypassword"
msg = "enter password"
response = InputBox(msg)
If response = myresponse Then
Worksheets("Sheet1").Cells(1, 1).Value = Now
Else
ActiveWorkbook.Close
End If

End Sub
This prevents the workbook opening 31 days after a certain date.
In this example the date you want the 31 days to run from is in A1 of
sheet1
which would need to be hidden and protected. Giving the correct
password
changes that date and gives a further 31 days of usage.

I'm afraid it's not very secure though.

Mike
"FARAZ QURESHI" wrote:

Can I have a macro written so as to expire/discard/terminate all the
macros
in the current file after a month so as to restrict anyone else
taking
benefit of using the same unless I renew the date therein. However, I
don't
want the existing contents of the file to be damaged.

Thanx









All times are GMT +1. The time now is 05:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com