Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Limit use Of Workbook
I would like to send a workbook to a potential client but I would only want
them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker |
#2
|
|||
|
|||
Not reliably. Almost anything you (well, I) would do would be based on macros.
And macros can be disabled or modified. (Project protection for the workbook can be broken pretty simply.) GWB Direct wrote: I would like to send a workbook to a potential client but I would only want them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker -- Dave Peterson |
#3
|
|||
|
|||
Most of my clients don't have the qualifications to diabled or modify a
macro. Could you direct me as to how it can be done. Is there a help screen in Microsoft that would show me how to create that type of macro. Thanks for you assistance so far. "Dave Peterson" wrote: Not reliably. Almost anything you (well, I) would do would be based on macros. And macros can be disabled or modified. (Project protection for the workbook can be broken pretty simply.) GWB Direct wrote: I would like to send a workbook to a potential client but I would only want them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker -- Dave Peterson |
#4
|
|||
|
|||
No there isn't.
You could do something like this Const MaxRuns = 3 Private Sub Workbook_BeforeClose(Cancel As Boolean) If cRuns <= MaxRuns Then ThisWorkbook.Names.Add Name:="_RunLimit", RefersTo:=cRuns End If End Sub Private Sub Workbook_Open() Dim cRuns As Long On Error Resume Next cRuns = Evaluate(ActiveWorkbook.Names("_RunLimit").RefersT o) cRuns = cRuns + 1 If cRuns MaxRuns Then ThisWorkbook.Close savechanges:=False End If End Sub which goes in the ThisWorkbook code module. -- HTH Bob Phillips "GWB Direct" wrote in message ... Most of my clients don't have the qualifications to diabled or modify a macro. Could you direct me as to how it can be done. Is there a help screen in Microsoft that would show me how to create that type of macro. Thanks for you assistance so far. "Dave Peterson" wrote: Not reliably. Almost anything you (well, I) would do would be based on macros. And macros can be disabled or modified. (Project protection for the workbook can be broken pretty simply.) GWB Direct wrote: I would like to send a workbook to a potential client but I would only want them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker -- Dave Peterson |
#5
|
|||
|
|||
Bob's suggestion works if the workbook is going to be saved. But if the
workbook isn't saved, then the limit will never be reached. You could store that counter in the windows registry (but anyone could look to find this, too). And that means that each user of the workbook would get 3 times where they could open the workbook. Option Explicit Private Sub Workbook_Open() Dim myApplication As String Dim mySection As String Dim myKey As String Dim myMax As Long Dim myCounter As Long Dim myDefault As Long myApplication = "MyTestProgram" mySection = "MyKeys" myKey = "MyCounter" myDefault = 0 myMax = 3 myCounter = GetSetting(myApplication, mySection, myKey, myDefault) If myCounter = myMax Then MsgBox "This workbook must close" Me.Close savechanges:=False Else SaveSetting myApplication, mySection, myKey, myCounter + 1 End If End Sub Again, if macros are disabled (or if the workbook_open/auto_open subs are turned off), then this won't work either. And remember to protect the project so that the casual user can't change that number. Inside the VBE, Tools|VBAProject Properties|Protection tab. And that protection is pretty weak, too. By the way, if you're testing and you want to clean up this testing, you can do this: Open excel hit alt-f11 to view the VBE hit ctrl-g to view the immediate window Type this and hit enter: DeleteSetting "MyTestProgram" (use the same key as you used in the workbook_open event. <yep, anyone who can find this post in Google, can do it, too. GWB Direct wrote: Most of my clients don't have the qualifications to diabled or modify a macro. Could you direct me as to how it can be done. Is there a help screen in Microsoft that would show me how to create that type of macro. Thanks for you assistance so far. "Dave Peterson" wrote: Not reliably. Almost anything you (well, I) would do would be based on macros. And macros can be disabled or modified. (Project protection for the workbook can be broken pretty simply.) GWB Direct wrote: I would like to send a workbook to a potential client but I would only want them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker -- Dave Peterson -- Dave Peterson |
#6
|
|||
|
|||
I can't get this to work. Where it says add names in the code do I put the
name of the workbook. I use macros but I'm not an expert as you can probably tell. Thanks in advance for you assistance. -- Gary Baker "Bob Phillips" wrote: No there isn't. You could do something like this Const MaxRuns = 3 Private Sub Workbook_BeforeClose(Cancel As Boolean) If cRuns <= MaxRuns Then ThisWorkbook.Names.Add Name:="_RunLimit", RefersTo:=cRuns End If End Sub Private Sub Workbook_Open() Dim cRuns As Long On Error Resume Next cRuns = Evaluate(ActiveWorkbook.Names("_RunLimit").RefersT o) cRuns = cRuns + 1 If cRuns MaxRuns Then ThisWorkbook.Close savechanges:=False End If End Sub which goes in the ThisWorkbook code module. -- HTH Bob Phillips "GWB Direct" wrote in message ... Most of my clients don't have the qualifications to diabled or modify a macro. Could you direct me as to how it can be done. Is there a help screen in Microsoft that would show me how to create that type of macro. Thanks for you assistance so far. "Dave Peterson" wrote: Not reliably. Almost anything you (well, I) would do would be based on macros. And macros can be disabled or modified. (Project protection for the workbook can be broken pretty simply.) GWB Direct wrote: I would like to send a workbook to a potential client but I would only want them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker -- Dave Peterson |
#7
|
|||
|
|||
Thanks Dave. Although this may not be the perfect solution, it's better than
nothing. I appreciate your time and assistance. Hope ypu don't mind but I will probably have other questions after I attempt to use this code. -- Gary Baker "Dave Peterson" wrote: Bob's suggestion works if the workbook is going to be saved. But if the workbook isn't saved, then the limit will never be reached. You could store that counter in the windows registry (but anyone could look to find this, too). And that means that each user of the workbook would get 3 times where they could open the workbook. Option Explicit Private Sub Workbook_Open() Dim myApplication As String Dim mySection As String Dim myKey As String Dim myMax As Long Dim myCounter As Long Dim myDefault As Long myApplication = "MyTestProgram" mySection = "MyKeys" myKey = "MyCounter" myDefault = 0 myMax = 3 myCounter = GetSetting(myApplication, mySection, myKey, myDefault) If myCounter = myMax Then MsgBox "This workbook must close" Me.Close savechanges:=False Else SaveSetting myApplication, mySection, myKey, myCounter + 1 End If End Sub Again, if macros are disabled (or if the workbook_open/auto_open subs are turned off), then this won't work either. And remember to protect the project so that the casual user can't change that number. Inside the VBE, Tools|VBAProject Properties|Protection tab. And that protection is pretty weak, too. By the way, if you're testing and you want to clean up this testing, you can do this: Open excel hit alt-f11 to view the VBE hit ctrl-g to view the immediate window Type this and hit enter: DeleteSetting "MyTestProgram" (use the same key as you used in the workbook_open event. <yep, anyone who can find this post in Google, can do it, too. GWB Direct wrote: Most of my clients don't have the qualifications to diabled or modify a macro. Could you direct me as to how it can be done. Is there a help screen in Microsoft that would show me how to create that type of macro. Thanks for you assistance so far. "Dave Peterson" wrote: Not reliably. Almost anything you (well, I) would do would be based on macros. And macros can be disabled or modified. (Project protection for the workbook can be broken pretty simply.) GWB Direct wrote: I would like to send a workbook to a potential client but I would only want them to be able to use it 2 or 3 times. Is there a way to do this. I am using Xcel 2003. My operating system is Windows XP. -- Gary Baker -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
HOW DO I SUM TWO CELLS FROM ONE WORKBOOK TO ANOTHER WORKBOOK? | Excel Worksheet Functions | |||
How to hyperlink from a workbook to sheets in another workbook? | Excel Worksheet Functions | |||
Unprotect Workbook | Excel Discussion (Misc queries) | |||
How do I limit the number of times an Excel workbook can be opene. | Excel Discussion (Misc queries) | |||
Stubborn toolbars in Excel | Excel Discussion (Misc queries) |