Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
GWB Direct
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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   Report Post  
GWB Direct
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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   Report Post  
GWB Direct
 
Posts: n/a
Default

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   Report Post  
GWB Direct
 
Posts: n/a
Default

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
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
HOW DO I SUM TWO CELLS FROM ONE WORKBOOK TO ANOTHER WORKBOOK? Bill O'Neal Excel Worksheet Functions 8 August 14th 09 11:36 PM
How to hyperlink from a workbook to sheets in another workbook? MJOHNSON Excel Worksheet Functions 0 February 17th 05 08:31 PM
Unprotect Workbook Kent Excel Discussion (Misc queries) 1 February 4th 05 01:07 AM
How do I limit the number of times an Excel workbook can be opene. Chris Excel Discussion (Misc queries) 8 January 19th 05 04:02 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 09:50 AM.

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

About Us

"It's about Microsoft Excel"